Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW
 
PerlMonks  

Re^4: coding rules

by ihb (Deacon)
on Aug 05, 2005 at 23:00 UTC ( #481393=note: print w/replies, xml ) Need Help??


in reply to Re^3: coding rules
in thread coding rules

Package variables are the worst, because their scope transcends a single file.

How are package variables worse than file-scoped lexicals? If it's because it allows people to mess with parts of your code that you didn't intend, then why use a package variable instead of a file-scoped lexical? (Yes, there are a few rare legitimate reasons.) If you have a legitimate reason for using it but it's not a part of the interface, is it bad because you feel a need to "protect" your variables from users? (If that's the case I guess regular subroutines are bad too.) If you have it like a package variable because it's a part of the interface, then it's not evil. Those are the cases I can think of where I'd use package variables in modules, and I can't figure out why you think package variable are "the worst". Can you elaborate?

ihb

See perltoc if you don't know which perldoc to read!

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others about the Monastery: (5)
As of 2020-10-30 20:01 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    My favourite web site is:












    Results (284 votes). Check out past polls.

    Notices?