My system is set up with several core object classes, a 'core' class, and a separate module that handles login and privilege granting. Let's call the core package 'BDB::PPA', the login/privilege module 'BDB::PPALogin', and one of the core objects 'BDB::pinfo'.
The PPALogin class exports several functions, the most important to me are isSuper() and has_priv(), which I use all over the other packages to check for appropriate permissions before running code. The top of my PPALogin package looks like this:
package BDB::PPALogin; use strict; BEGIN { require Exporter; our @ISA = qw (Exporter); our @EXPORT = qw ( isSuper has_priv [...] ); }
This should have lead to the ability for my other modules, namely BDB::pinfo, to call isSuper() anywhere in code without the package prefix. It was working until two days ago, when for some reason it ceased to function as expected, and required me to prefix all of those function calls with the package. I know there are some circular references between the modules, but my understanding is those should be resolved appropriately by using the BEGIN {} block in PPALogin. To be verbose:
package BDB::pinfo; [ other code / use statements ] sub canSeeMe { eval { if ( isSuper() ) { # This used to work, but now fails } } eval { if ( BDB::PPALogin::isSuper() ) { # This has always worked, but I *really* don't want to +type the package name in code every time... } } }
Any advice on where to look or what additional code I can add to ensure / force the functions from PPALogin to export before any other module needs them?
For reference, I'm running Perl 5.10.1 on a LAMP box with mod_perl.
Thanks,
Joe
In reply to Exporter behavior by dymium
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |