Hi there,

I'm trying to figure out how one would set vars via a startup.pl script or 
using PerlSections. I want to set a var on startup where I'll be prompted 
and a var that I can retrieve via $r->dir_config('FOO') will get me that 
value.

I've tried endless ideas, none of which are working

The most promising is using PerlSections:

<Perl>
        use Apache::PerlSections();

        $Apache::Server::SaveConfig = 1;

        if ($Apache::Server::Starting) {
                print "Enter some value you don't want written down: ";
                $mytmp::value = <STDIN>;
                chomp $mytmp::value;
        } else {
                print "value = '$mytmp::value'\n";
                push @PerlSetVar, ["Foo" => $mytmp::value];
        }


        print STDERR Apache::PerlSections->dump();

</Perl>

This is listed on 
http://www.geocrawler.com/archives/3/182/2002/11/0/10255638/ and is an 
example by Stas Bekman. For me, it only works if I run a single httpd via 
-X (I set this in apachectl). It's something to do with the double start, 
which this example is supposed to overcome.

Other things I've tried are using "HTTPD="/usr/sbin/httpd `moduleargs`
$OPTIONS" -c $PERLSETVAR" where $PERLSETVAR is set via $2
apachectl start foopass

PERLSETVAR="PerlSetVar FOO $2"

But I'm not the best shell programmer, and somehow the shell program 
munges the PerlSetVar line. If I take the same output and run it via 
command line:

/usr/sbin/httpd -DHAVE_SETENVIF -DHAVE_CERN_META -DHAVE_EXPIRES 
-DHAVE_ACCESS -DHAVE_ASIS -DHAVE_NEGOTIATION -DHAVE_AUTH -DHAVE_IMAP 
-DHAVE_USERTRACK -DHAVE_INFO -DHAVE_SSL -DHAVE_AUTH_DBM -DHAVE_AUTH_DB 
-DHAVE_VHOST_ALIAS -DHAVE_ACTIONS -DHAVE_LOG_CONFIG -DHAVE_LOG_AGENT 
-DHAVE_MMAP_STATIC -DHAVE_PROXY -DHAVE_PERL -DHAVE_MIME_MAGIC 
-DHAVE_EXAMPLE -DHAVE_STATUS -DHAVE_PHP4 -DHAVE_LOG_REFERER -DHAVE_ALIAS 
-DHAVE_MIME -DHAVE_SPELING -DHAVE_AUTOINDEX -DHAVE_USERDIR 
-DHAVE_UNIQUE_ID -DHAVE_REWRITE -DHAVE_CGI -DHAVE_INCLUDE -DHAVE_DIR 
-DHAVE_ENV -DHAVE_AUTH_ANON -DHAVE_DIGEST -DHAVE_HEADERS  -c 'PerlSetVar 
PASS foo'

It works, but that's not a good solution.

I've tried things like a set method that sets a class variable of the 
handler I'm calling in startup.pl.. doesn't work.

So, I'm stumped. Any ideas? I'd be so greatful!

-- 
Patrick Galbraith
Senior Software Developer
[EMAIL PROTECTED]
[EMAIL PROTECTED] [EMAIL PROTECTED]

Reply via email to