D
Dean Hannotte
I'm writing a content management system and I've put some generally useful
routines into a common library that I invoke by starting my scripts with
'use cms;'. I then use a configuration file to initialize certain global
variables by coding 'require config.pl'. The problem is, I can't figure out
how I can get the library routines to see the globals that I've set in
'config.pl'. When I refer to these values from any of the library routines,
their values are undefined. I guess segregating code into a Perl module puts
it into a completely separate namespace.
If I code 'require config.pl' from inside 'cms.pm', then the library sees
the values, but the script doesn't! So I guess there's an internal mechanism
to prevent the loading of the same 'require' more than once in the same run?
How can I get the library, 'cms.pm', to see the same values that my scripts
see when they 'require config.pl' without having to pass these values as
subroutine parameters? Thanks!
Dean Hannotte
http://www.hannotte.net
routines into a common library that I invoke by starting my scripts with
'use cms;'. I then use a configuration file to initialize certain global
variables by coding 'require config.pl'. The problem is, I can't figure out
how I can get the library routines to see the globals that I've set in
'config.pl'. When I refer to these values from any of the library routines,
their values are undefined. I guess segregating code into a Perl module puts
it into a completely separate namespace.
If I code 'require config.pl' from inside 'cms.pm', then the library sees
the values, but the script doesn't! So I guess there's an internal mechanism
to prevent the loading of the same 'require' more than once in the same run?
How can I get the library, 'cms.pm', to see the same values that my scripts
see when they 'require config.pl' without having to pass these values as
subroutine parameters? Thanks!
Dean Hannotte
http://www.hannotte.net