You are viewing a plain text version of this content. The canonical link for it is here.
Posted to modperl@perl.apache.org by Octavian Rasnita <or...@fcc.ro> on 2005/04/26 11:10:59 UTC
do is not working?
Hi,
I have tried the following test script under mod_perl using
ModPerl::Registry handler:
use strict;
use warnings;
my $m = do "/usr/local/intranet/site/modules/markets.ini";
use Data::Dumper;
print Dumper $m;
The program prints "$VAR1 = undef;" if I run the program running mod_perl.
It prints fine the hash if I run it from command line.
The file "markets.ini" is:
{
'var1' => 'value1',
'var2' => 'value2',
'var3' => 'value3',
}
Do you have any idea what is wrong?
Thank you very much.
Teddy
Re: do is not working?
Posted by "JupiterHost.Net" <ml...@jupiterhost.net>.
Octavian Rasnita wrote:
> Hi,
Hello,
> I have tried the following test script under mod_perl using
> ModPerl::Registry handler:
>
> use strict;
> use warnings;
>
> my $m = do "/usr/local/intranet/site/modules/markets.ini";
> use Data::Dumper;
> print Dumper $m;
>
> The program prints "$VAR1 = undef;" if I run the program running mod_perl.
>
> It prints fine the hash if I run it from command line.
>
> The file "markets.ini" is:
>
> {
> 'var1' => 'value1',
> 'var2' => 'value2',
> 'var3' => 'value3',
> }
>
> Do you have any idea what is wrong?
perldoc -f do
If "do" cannot read the file, it returns undef and sets
$! to
the error. If "do" can read the file but cannot compile
it, it
returns undef and sets an error message in $@. If the
file is
successfully compiled, "do" returns the value of the last
expression evaluated.
So I imagine its permissions vs. environment :)
Without error checking its hard to say, try what perldoc -f do says to
do to get the status.
Re: do is not working?
Posted by Stas Bekman <st...@stason.org>.
Octavian Rasnita wrote:
> Hi,
>
> I have tried the following test script under mod_perl using
> ModPerl::Registry handler:
>
> use strict;
> use warnings;
>
> my $m = do "/usr/local/intranet/site/modules/markets.ini";
> use Data::Dumper;
> print Dumper $m;
>
> The program prints "$VAR1 = undef;" if I run the program running mod_perl.
>
> It prints fine the hash if I run it from command line.
>
> The file "markets.ini" is:
>
> {
> 'var1' => 'value1',
> 'var2' => 'value2',
> 'var3' => 'value3',
> }
>
> Do you have any idea what is wrong?
>
> Thank you very much.
>
> Teddy
perldoc -f do:
[...]
If "do" cannot read the file, it returns undef and sets $! to the
error. If "do" can read the file but cannot compile it, it returns
undef and sets an error message in $@. If the file is successfully
compiled, "do" returns the value of the last expression evaluated.
You need to check that do() has succeeded and if not die with $! so you
can see what's wrong.
Most likely your perms are wrong and the Apache server fails to read that
file. Make sure that your files are r and your dirs are rx by the user you
run the Apache under.
--
__________________________________________________________________
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