I am having trouble creating a modules which splits its functions and variables between two files in two separate directories.
I want to have a set of global functions (i.e. open database connection...) which would live in the main Perl path, and a local configuration file (containing Host name, user name, password...) which would live in the user's local directory. When the module was called, it would instantiate with the local variables. Here is what I have tried: GLOBAL FUNCTIONS in: /usr/lib/perl5/5.8.0/MetaManageGlobal.pm: package MetaManagerGlobal; require Exporter; our ($VERSION, $dbh); our @ISA = qw(Exporter); our @EXPORT = qw(connectDb $dbh); $VERSION = "1.0.0"; # Content Database connect sub connectDb { require DBI; $dbh = DBI->connect("dbi:mysql:$cfg->{dbName}:$cfg->{dbServer}", $cfg->{ dbUser}, $cfg->{dbPassword}) || Die $DBI::errstr; } +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ LOCAL VARIALBES in: /home/httpd/html/admin/MetaManager.pm: package MetaManager; require Exporter; require MetaManagerGlobal; our ($VERSION, $cfg, $dbh); our @ISA = qw(Exporter); our @EXPORT = qw(connectDb $dbh $cfg); $VERSION = "1.0.0"; $cfg->{dbServer} = "Host Name"; # Database server host $cfg->{dbName} = "Database Name"; # Database name $cfg->{dbUser} = "User Name"; # Database user $cfg->{dbPassword} = "Password"; # Database password +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ >From the page (which uses Apache::ASP) I want to be able to simply call the function: <% use MetaManager; ConnectDb(); %> And have my database handle opened to whatever specifications exist in the local MetaManager.pm module. When I try this, the ConnectDb function is found, but no Db is opened, suggesting to me that the variables are not being properly scoped or imported. Many thanks for assistance. Andrew Koebrick Web Coordinator / Librarian Dept. of Administration State of Minnesota 658 Cedar St. St. Paul, MN 55155 651-296-4156 http://server.admin.state.mn.us -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>