has anyone here been able to do multiple directives (such as
three or more "PerlSetVar") via <perl> sections, from inside the
%VirtualHost{$NameVirtualHost} hash? we haven't been able to
figure it out:

here are the four ways we figured might work; but each of them
generates a "PerlSetVar requires two args only" error... pooh.



1. string pairs (doesn't work):

%VirtualHost = ( $NameVirtualHost => [
#snip
        PerlSetVar => [
                MasonCompRoot        => "/var/www/$site",
                MasonDataDir         => "/var/cache/mason/$site",
                MasonAutoHandlerName => "$autohandlername",
                MasonDHandlerName    => "$dhandlername",
                MasonDeclineDirs     => "0",
        ],
#snip
] );

altho this is what the documentation means (see
http://perl.apache.org/docs/2.0/api/Apache/PerlSections.html)
when it says "shifted off the @list":

        If an Apache directive can take two or three arguments you
        may push strings (the lowest number of arguments will be
        SHIFTED OFF THE @LIST) or use an array reference to handle
        any number greater than the minimum for that directive:

it doesn't work if you can have multiple occurrences on a
directive that takes a consistent number of (in this case,
two) args.



2. string expressions (doesn't work):

        PerlSetVar => [
                "MasonCompRoot        /var/www/$site",
                "MasonDataDir         /var/cache/mason/$site",
                "MasonAutoHandlerName $autohandlername",
                "MasonDHandlerName    $dhandlername",
                "MasonDeclineDirs     0",
        ],



3. sub-arrays (doesn't work):

        PerlSetVar => [
                ["MasonCompRoot",        "/var/www/$site",],
                ["MasonDataDir",         "/var/cache/mason/$site",],
                ["MasonAutoHandlerName", "$autohandlername",],
                ["MasonDHandlerName",    "$dhandlername",],
                ["MasonDeclineDirs",     "0",],
        ],

altho this is what the documentation (ibid) implies when it says
to "use an array reference":

        If an Apache directive can take two or three arguments you
        may push strings (the lowest number of arguments will be
        shifted off the @list) or USE AN ARRAY REFERENCE to handle
        any number greater than the minimum for that directive:

apparently not applicable for "two-only" directives. major
bummer.



4. sub-expressions (doesn't work):

        PerlSetVar => [
                [ "MasonCompRoot        /var/www/$site", ],
                [ "MasonDataDir         /var/cache/mason/$site", ],
                [ "MasonAutoHandlerName $autohandlername", ],
                [ "MasonDHandlerName    $dhandlername", ],
                [ "MasonDeclineDirs     0", ],
        ],



they all generate the "only two args, please" error.

NOTE that it does accept two args, if that's all you give it:

        ...
        PerlSetVar => [
                SomeVarName => 'someValueHere'
        ],
        ...

just as it should. but we need several "perlsetvar"!

here's the httpd.conf set we're trying to replicate, which is
certainly legitimate config syntax:

<VirtualHost *:80>
        #snip
        PerlSetVar MasonCompRoot        /var/www/mysite
        PerlSetVar MasonDataDir         /var/cache/mason/mysite
        PerlSetVar MasonAutoHandlerName myautohandlername
        PerlSetVar MasonDHandlerName    mydhandlername
        PerlSetVar MasonDeclineDirs     0
        #snip
</VirtualHost>


        bottom line:
        ============

        all we want to do is replicate the above kind of setup (via
        perl, in <perl> sections or startup.pl). isn't there a way
        to do so?



version info:

# apache2 -v
Server version: Apache/2.0.48
Server built:   Jan 30 2004 20:35:32
# uname -a
Linux tigris 2.4.21-xfs #13 SMP Tue Aug 26 01:46:14 CEST 2003 i686 GNU/Linux


-- 
will trillich
http://www.serensoft.com/
http://www.midwestRepo.com/
http://www.skylineAuto.net/


-- 
Report problems: http://perl.apache.org/bugs/
Mail list info: http://perl.apache.org/maillist/modperl.html
List etiquette: http://perl.apache.org/maillist/email-etiquette.html

Reply via email to