>I am playing around with a set of perl scripts. Need to figure out >following things. >A) move out common code from the set of scripts and have them include >that common code. (something equivalent of #include!) . Most of the >common code is about some arguments (proxy-url, database, user, pass >...), which are currently hard coded in these scripts. I don't want to >end up editing each of the file when I want to change my params.
You may define all those arguments in a package and 'use' this package to import the arguments into the main scripts. ie,in the package we define the global arguments, package MyArguments; use base qw/Exporter/; our @EXPORT = qw/$proxy_url $database $user/; our $proxy_url = ...; our $database = ...; our $user = ...; 1; Then in the main script, use MyArguments; print $proxy_url; print $database; print $user; ... __END__ But,as Randal suggested few days ago,for the best solution,you may always export methods from package,don't export global variables. >B) I am using some perl modules installed locally. Whats the best way to >specify include path. Currently I am using "-I" option hardcoded in each >of the .pl files, and I will be running these as crontab jobs. The better way I can think is adding this statement in the begin of your scripts, use lib qw(/path/1 /path/2); use MyLib1; use MyLib2; Here given the MyLib1 is located in /path/1 and MyLib2 is located in /path/2.This can work well. Hope this helps! -- http://home.arcor.de/jeffpang/ -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/