in reply to How to make Common Variables defined in Module available to Scripts
I generally steer towards using a 'Constants' package for such things.
package SUP::ServerConstants; use strict; use vars qw/@EXPORT @EXPORT_OK/; require Exporter; use base qw/ Exporter /; use Data::Dumper; @EXPORT = qw/SERVER_NAME MYSQL_PORT SERVER_ID/; @EXPORT_OK = qw/HTTP_PROXY PATH_TO_BINARIES/; use constant SERVER_NAME => 'http://FOO'; use constant MYSQL_PORT => '3308'; use constant SERVER_ID => '44'; use constant HTTP_PROXY => ''; use constant PATH_TO_BINARIES = '/var/foo';
Then to access them in your script you would have something like...
#!/usr/bin/perl -w use strict; use SUP::ServerConstants qw/PATH_TO_BINARIES/; print PATH_TO_BINARIES;
|
|---|