Is the keyword "our" treated differently for modules?

Ex:
Test.pl:
#!/Perl/bin/perl
use testpack;
our $JobName = 'foo';
testpack::testfunc(); #line A
exit 0;

testpack.pm:
package testpack;
sub testfunc;
our $JobName;
sub testfunc
{
        my $x = 1;  #at this point $JobName is undefined
        return; #line B
}
1;


I know that if I replace line A with:
do $scriptname
and $scriptname contains an "our $JobName" it will be defined.

Why do I lose the value of $JobName when defining it as "our" from script to
package, but not from script to script?

I can do this at line B: $JobName = $main::JobName; and then $JobName will
be defined same in package and script, however that defeats the purpose of
using the "our" keyword.

-Wayne Simmons
_______________________________________________
ActivePerl mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Reply via email to