Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?
 
PerlMonks  

Re^5: standard perl module and BEGIN block.

by ikegami (Patriarch)
on Jun 12, 2010 at 19:00 UTC ( [id://844365]=note: print w/replies, xml ) Need Help??


in reply to Re^4: standard perl module and BEGIN block.
in thread standard perl module and BEGIN block.

Using our for a var that hadn't previously been declared with use vars would raise an error. As would attempting to use a global mentioned in use vars, without also having scoped it using our.

The difference between use vars and our is that the former allows a module's variables to be used from outside the module.

# Would warn if Data::Dumper used 'our' instead of 'use vars'. local $Data::Dumper::Useqq = 1;

Your idea would reverse the purpose of use vars. Instead of allowing a variable to be used outside the module, it would prevent the variable from being used outside the module.

The underlying idea is good, but you'd need to use something other than use vars.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://844365]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others examining the Monastery: (4)
As of 2024-03-29 09:19 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found