Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid
 
PerlMonks  

Why are you sharing constants in a module?

by rrwo (Friar)
on Nov 24, 2004 at 11:35 UTC ( [id://410112]=note: print w/replies, xml ) Need Help??


in reply to inheritance of constants

This might be completely off the mark, but why are you putting constants in a module instead of a configuration file?

If it's to "hide" login information so that it's not in a script where people may be able to see it, that may not be a good idea since anyone who can access the module in a script with a 'use' call can access that information.

In some cases it makes more sense to put that information in a separate configuration file that you can restrict access to certain processes.

Other advantages of using a configuration file as opposed to a module:

  • A sysadmin can change a configuration file without touching code and accidentally causing an error.
  • The same code can be used for multiple databases by changing a reference to the configuration file rather than creating another module.
  • Comment on Why are you sharing constants in a module?

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others browsing the Monastery: (3)
As of 2025-01-16 04:09 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Which URL do you most often use to access this site?












    Results (53 votes). Check out past polls.