On Aug 24, 2007, at 11:58 AM, Sundeep Gupta wrote:
The problem was that this module (XYZ) module uses another module,
which
again has the use statement to load XYZ. I don't know if the perl
loads the
module again and might be this caused to reset the value back to 0.
When I commented the use statement of that module, it just works fine.
If you load a module with use(), it will only get loaded once, no
matter how many use()s for that module are executed throughout the
source tree. In particular the package variable is not reset:
[EMAIL PROTECTED]:~/tmp$ cat Foo.pm
use strict;
package Foo;
our $x = 0;
1;
[EMAIL PROTECTED]:~/tmp$ perl -MFoo -wle '$Foo::x = 1; use Foo; print
$Foo::x'
1
-- fxn
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/