Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change
 
PerlMonks  

Re: including variables

by tinita (Parson)
on Feb 16, 2018 at 23:33 UTC ( [id://1209347]=note: print w/replies, xml ) Need Help??


in reply to including variables

It might also be worth considering a configuration file. This depends on your variable definitions, of course, but if they don't require to be perl code, an INI/JSON/YAML file could be the better solution.

If this is not possible, I would probably use a module and let it export a $config hashref. This has the advantage that it's clear in the main code where the variable is coming from.
use MyConfig qw/ $config /; say $config->{somekey};
Letting code "import" a number of variables implicitly is usually a bad idea in my experience.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others chilling in the Monastery: (3)
As of 2024-04-23 06:32 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found