in reply to Re^5: standard perl module and BEGIN block.
in thread standard perl module and BEGIN block.
Yes. And in this code:
package Some:Module; use vars q/test/; ## Here "Global symbol "$test" requires explicit package name". $test = 1; sub inHere { our $test; # ok. our $tset; # typos/thinkos causes errors. my $test; # my variable "$test" overrides variable with the same name at differe +nt scope... } 1; Some::Other::Module; sub inThis { our $test; ## is an error. }
If it is possible to get this behaviour, changing use vars; to work this way would probably cause backward compatibility issues, so maybe use globals qw/$var @var %var/; would make more sense.
That said, maybe something like $var : global = 1; would be more in keeping with the latest trends and prehaps more compatible with P6.
|
|---|