Is there anyway to get Exporter to overwrite subroutines that have already been defined? i.e. I would like the output of test.pl below to be "module subroutine" but can't get that behavior w/o the commented out line.
---- test.pl ----
#!/usr/bin/perl use My::Module qw(testsub); ### works, but seems to defeat the purpose of Exporter # *testsub = \&My::Module::testsub; print testsub(), "\n"; sub testsub { # "local" definition of subroutine return "local subroutine"; }
---- My/Module.pm ----
I've looked at the specific mod_perl related modules (Apache::StatINC, Apache::Reload, Stonehenge::Reload) but none of them seem to address this. They all seem to work fine if you use the full package (i.e. print My::Module::testsub(); works fine above) but I can't get main::testsub to see the new code w/o explicitly forcing it. Any ideas?package My::Module; BEGIN { use Exporter (); @ISA = qw(Exporter); @EXPORT_OK = qw(testsub); } sub testsub { # new definition for subroutine return "module subroutine"; } 1;
-Blake
In reply to Redefining Exported Subroutines (esp. in mod_perl/mason) by blakem
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |