From: Jamie C. <jca...@we...> - 2002-10-26 00:28:44
|
Wil Cooley wrote: > I've noticed that although the docs say > > When your functions are called, they will be in the context of your > module. This means that your useradmin_update.pl script can > require the file of common functions used by other CGI programs. The > functions can perform any action you like in order to update other > config files or whatever, but should not generate any output on > STDOUT, or take too long to execute. > > that having > > require "../web-lib.pl" ; > &init_config() ; > > at the top of the script DID NOT actually pull in my module's > configuration information. At least, it wasn't available within my > useradmin_*_user subroutines. My subroutines actually test for > automatic creation being enabled before running, so I noticed right away > they weren't actually running. I did a hash dump to verify and the keys > in %::config seem to actually be the configured keys from 'useradmin'. > > I found I was able to get my module's %::config if is put the 'require' > and 'init_config' at the beginning of my subroutines. However, I fear I > might be causing untoward side-effects, because after doing this, the > "Return to" link at the bottom of the user add and delete response pages > actually points to my module, not the useradmin module! > > This is with 0.98 installed; I don't see anything mentioned in the > change log about this. What I usually have in my useradmin_update.pl script is a line at the top like : do 'mymodule-lib.pl'; and in mymodule-lib.pl, lines like : do '../web-lib.pl'; &init_config(); This sets %config just fine for me. require shouldn't be used in this case, because Perl will not actually re-read web-lib.pl if it thinks that it has been require'd before! - Jamie |