Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses
 
PerlMonks  

Re: Variable Declaration

by blackmateria (Chaplain)
on Oct 19, 2001 at 15:03 UTC ( [id://119939]=note: print w/replies, xml ) Need Help??


in reply to Variable Declaration

Duplicated code and global variables are both pure evil, IMHO. I'm not sure which is worse in general, but in this case I think having the same info duplicated between 15 scripts would definitely be more of a Bad Thing(tm) than using globals (/me dons handy flame-retardant suit... :)

I think the best choice you mentioned is definitely the "functions file" method (a module even?) with a function returning the proper settings. Personally, I wouldn't hard-code global values into the code though, at least not if they're likely to ever change. Use a separate configuration file (e.g. a text file) instead. This way once you get your code working you don't have to go back and change it just because you moved the database.

Hope this helps!

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (3)
As of 2024-04-26 02:16 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found