We don't bite newbies here... much | |
PerlMonks |
comment on |
( [id://3333]=superdoc: print w/replies, xml ) | Need Help?? |
Another approach in newer perls gives something that looks very C-like in use. Make foo an lvalue accessor which takes no arguments:
The BEGIN block is only needed to get the "default" value in early (completely unneeded in this simple case). In a module, you can leave 'foo' off the @EXPORT_OK list so it's perlishly private to the module package. For thread safety, you'd want the 'locked' attribute, besides 'lvalue'. Update: Added clarification on the BEGIN block, and an unwise adverb. After Compline, In reply to Re: Something like c++'s static?
by Zaxo
|
|