Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"
 
PerlMonks  

Re: Should you use a module to hold configuration items?

by sundialsvc4 (Abbot)
on Oct 25, 2010 at 22:26 UTC ( [id://867363]=note: print w/replies, xml ) Need Help??


in reply to Should you use a module to hold configuration items?

One general comment I’d make, in any case, is that:   you should also consider how these configuration options will be queried and used, no matter how you store them.   I like to build a Settings.pm module (say...) which contains “the code to answer any question that this application might need to ask about|using its configuration settings.”   This module also encapsulates the process of determining what the configuration-settings are.   So, if the settings come from a database or an external file or what-have-you, this module will contain the logic to get them from that source.   Likewise, if the settings (or some of them) come from a Perl-module that is used, this module contains that use statement (and does not contain the settings statements themselves).

My Settings.pm module is, as is usual for me, “very suspicious.”   It not only gets the settings (by whatever means), but also thoroughly examines them.   All of the clients of that module, not only know where to go for the answers that they need, but also have some reason to believe that those answers will be correct.   Most of these checks are encapsulated in an initialization-routine that is called by the application at startup time.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others meditating upon the Monastery: (4)
As of 2024-03-28 16:59 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found