> 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...

-- 
netendance GmbH
Sören Stuckenbrock
Fränkische Straße 38
30455 Hannover

Telefon: 49 (0) 511/4733773
Fax    : 49 (0) 511/4733776
Mobil  : 49 (0) 173/6000319
http://www.netendance.de


Reply via email to