Case closed.
Danke an alle!
Tosh
Torsten Förtsch wrote:
On Friday 15 January 2010 00:41:25 Tosh Cooey wrote:
Well Gang, we solved the smaller @_ mystery but not the larger
"different behaviour under mod_perl" mystery.
No, we have.
A registry script is wrapped into a subroutine. So your i
On Friday 15 January 2010 00:41:25 Tosh Cooey wrote:
> Well Gang, we solved the smaller @_ mystery but not the larger
> "different behaviour under mod_perl" mystery.
>
No, we have.
A registry script is wrapped into a subroutine. So your index.pl will look
like:
sub ... {
package ...;
Ha ha! The ghost is me, I'm an archaic leftover! I did say I been in
this for 15 years ;)
Well Gang, we solved the smaller @_ mystery but not the larger
"different behaviour under mod_perl" mystery. I have my bets on it
being Old Man Jenkins trying to scare everybody away by wearing a costu
Hi Tosh,
The function sigil ("&") is an archaic left over from before perl5. Calling a
function as "&cfg" is the same as saying "&cfg(@_)" and that implicit "@_" was
probably the source of your problem. A bit more information can be found here:
http://www.perlfoundation.org/perl5/index.cgi?subr
Ok now I'm really boggled...
If I use:
my $vars = { config => &cfg() };
instead of:
my $vars = { config => &cfg };
Then it works! So what's the difference between &cfg and &cfg() when it
comes to mod_perl, or at least ModPerl::Registry?
Thank-you all...
Tosh
Tosh Cooey wrote:
True, good
True, good point. I cleaned up my code and changed some things around
and I still have the same problem:
index.pl
use MyConfig;
use ClientConf;
use MyUser;
my $vars = { config => &cfg };
MyConfig.pm
###
package MyConfig;
use strict;
use Exporter;
use vars qw(@ISA @EXPORT);
Global? There's no need to use a global here. You only ever reference %CFG
*in* the package... so just make it package scoped - it'll act like a static
variable and persist. (scope it with 'my' and remove it from the export)
You can always get the value you want with a call to MyConfig::cfg