Alessandro Forghieri wrote:
This is a bit of a surprise.... the following, in fact, runs just fine:It works because Exporter aliases variables in the exporting package to the importing one and probably adds some black magic ;)
--Foo.pm--
package Foo;
use strict;
use warnings;
require Exporter;
our @ISA = qw(Exporter);
our @EXPORT_OK = ( qw( $foo ) );
our @EXPORT = qw();
our $VERSION = '0.01';
our $foo=1;
1;
--usefoo.pl
use strict;
use warnings;
use Foo qw($foo);
print "foo is $foo\n";
$ perl usefoo.pl
foo is 1
This is according to my instinct - and practice: I have been using this
idiom, under strict, for the longest time and the interpreter has never
raised an eyebrow about it. BTW, this also works with @IMPORT (not only with
@IMPORT_OK). I cannot give you a doc pointer that explicitely says that it
must be so (or why), though.
However I thought that you may have hit the problem described here:
http://perl.apache.org/docs/general/perl_reference/perl_reference.html#toc_Using_Exporter_pm_to_Share_Global_Variables
when the same variable is to be shared by several packages. But I guess that wasn't the case.
Can you reduce the code to a generic case so it can be reproduced at will? Does it behave the same with and without mod_perl?
__________________________________________________________________
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