S�ren Stuckenbrock wrote:
> Hi,
>
> thanks to all of your help, I found a way to achieve the following
> goal:
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.
This is not a mistake to use use() here, however misunderstanding how
it works may lead to mistakes in the future.
Another comment is that it's a good idea to name your modules with some
prefix, which most likely won't collide with some core or 3rd party
modules. e.g. MyProjectName::netContestConfig. (whereas MyProjectName,
is the name of your project :)
__________________________________________________________________
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