snorks has asked for the wisdom of the Perl Monks concerning the following question:
I've created the file with DB connection info and some other basic stuff and am using "require ./config.pl" in each of the scripts. The problem is that variable declaration in config.pl aren't avaliable in the other scripts. So after connecteing to the DB using the subroutine in config.pl $dbh and $sth aren't exported. The variables in question are initalised outside the subroutines but are in config.pl.
Also passing variables from the running script into a subroutine in config.pl seems to be impossible too, although I suspect thats all related to a namespace type problem. My understanding was that require effectivly made the files into one long file but apparently not
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: CGI and require
by davido (Cardinal) on May 30, 2004 at 04:09 UTC | |
|
Re: CGI and require
by sgifford (Prior) on May 30, 2004 at 04:38 UTC | |
|
Re: CGI and require
by tachyon (Chancellor) on May 30, 2004 at 04:48 UTC | |
by snorks (Initiate) on May 30, 2004 at 10:16 UTC |