Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?
 
PerlMonks  

Re: including variables

by tinita (Parson)
on Feb 16, 2018 at 23:33 UTC ( #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
Node Status?
node history
Node Type: note [id://1209347]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others wandering the Monastery: (4)
As of 2019-10-24 00:48 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Notices?