On Jan 23, 2004, at 8:27 AM, Geoffrey Young wrote:
it's not that I don't agree this ought to be fixed, or that with the patch
we have desirable behavior, it's just that I want it to be easy and the
current ServerRoot placement isn't really easy or intuitive. maybe
Apache::Test could export a SERVER_ROOT constant?
-0 here. too many exports, IMHO. If you make up SERVER_ROOT, at the end you will need to export most of the variables. But please see below.
How 'bout an object with all of the server attributes you could possibly need, easy to load up.
#!perl -w
use strict; use Apache::TestConfig;
Apache::TestConfig is an internal module. Apache::Test is the user interface.
use Test::More tests => 2;
ok( my $cfg = Apache::TestConfig->new, 'Get config' ); ok( my $server_root = $cfg->server_root, "Get server root" );
I suggest this only because I expect there'd be a lot more configuration information one might want to easily access than just the SERVER_ROOT.
You get that already, just a hash instead of accessors, rewriting your test:
#!perl -w
use strict; use Apache::Test; use Test::More tests => 2;
ok( my $cfg = Apache::Test::config()->{vars}, 'Get config' ); ok( my $serverroot = $cfg->{serverroot}, "Get server root" );
We could add a shortcut Apache::Test::vars() to replace Apache::Test::config()->{vars}. But quite often you need the config() object too.
If you really want to, we could install Apache::Test::AUTOLOAD
which will map $AUTOLOAD to Apache::Test::config()->{vars}->{$AUTOLOAD}, so you could say:
Apache::Test::serverroot
__________________________________________________________________ Stas Bekman JAm_pH ------> Just Another mod_perl Hacker http://stason.org/ mod_perl Guide ---> http://perl.apache.org mailto:[EMAIL PROTECTED] http://use.perl.org http://apacheweek.com http://modperlbook.org http://apache.org http://ticketmaster.com