Sören Stuckenbrock wrote:
>>Nice, but see below
>>
>>>somescript.pl
>>>-----------------------------------
>>>#!/usr/bin/perl -wT
>>>use strict;
>>>use lib ".";
>>>use lib_netContest;
>>>use DBI;
>>>use CGI (qw:standard:);
>>>
>>>use vars qw(%c $config_module $db_handle);
>>>
>>>my $r = shift;
>>>
>>>if (defined $r && $r->dir_config('ConfigMod')) {
>>>   $config_module = $r->dir_config('ConfigMod');
>>>}
>>>else {
>>>   use netContestConfig;
>>>   $config_module = "netContestConfig";
>>>}
>>
>>it's rather unusual to see use() inside the conditional code,
>>since use() is a compile time directive. meaning that netContestConfig
>>will be always loaded no matter if $r->dir_config('ConfigMod') returns
>>something or not.
>>
>>You probably want to s/use/require/. require() is a runtime directive.
>>Or move 'use netContestConfig;" to the top, so it'll be clear that it
>>always gets loaded.
> 
> 
> Good point, thanks! I will require the module to save the overhead of
> loading both configuration modules but using only one. Although the overhead
> should not be too big, if the "used but unused" module is emtpy...

Uhm, it has nothing to do with the overhead. use() is almost the same as 
require()
but is run at compile time. You probably need to read:
http://perl.apache.org/guide/perl.html#use_require_do_INC_and
perldoc -f use
perldoc -f require



-- 


__________________________________________________________________
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

Reply via email to