perl-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Stas Bekman <s...@stason.org>
Subject a new directive: PerlStartupFile?
Date Fri, 10 Dec 2004 01:21:54 GMT
As a followup to the discussed issue, we need to redefine the concept of:

   "put those things in startup.pl"

we now need to say:

    "put those things in post_config phase handler"

So users need to do:

PerlRequire "startup.pl"

startup.pl:

use Apache::ServerUtil ();
Apache->server->push_handlers(PerlPostConfigHandler =>
   sub { require "somefile.pl" });

which is not so easy as to say:

   "put those things in startup.pl"

if the path is not hardcoded or not in INC, for example to do it 
relatively, one needs to write as much as:

use Apache::ServerUtil ();
use Apache::ServerRec ();
use Apache::Process ();
my $s = Apache->server;
my $pool = $s->process->pool;
my $path = Apache::ServerUtil::server_root_relative($pool, "conf");
$s->push_handlers(PerlPostConfigHandler => sub {
     require "$path/post_config_startup.pl" });

So there is a possibility to introduce a new directive: PerlStartupFile 
(feel free to suggest a better name) which will be:

PerlStartupFile "somefile.pl"

which will do:

use Apache::ServerUtil ();
Apache->server->push_handlers(PerlPostConfigHandler =>
   sub { require "somefile.pl" });

internally. and this will eliminate the need for

PerlRequire "startup.pl"

if you don't want to load any config directives stuff.

after discussing this with gozer on irc we aren't sure this is a good 
idea, as for most people using the old startup.pl concept will still work. 
So your comments are welcome...

gozer and I think that we could add this directive later on, and just 
document the above code as "best practice" for now.

-- 
__________________________________________________________________
Stas Bekman            JAm_pH ------> Just Another mod_perl Hacker
http://stason.org/     mod_perl Guide ---> http://perl.apache.org
mailto:stas@stason.org http://use.perl.org http://apacheweek.com
http://modperlbook.org http://apache.org   http://ticketmaster.com

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@perl.apache.org
For additional commands, e-mail: dev-help@perl.apache.org


Mime
View raw message