in reply to Redefined import method and EXPORT not working
@EXPORT is not magical. It's just a variable. All the magic must happen in import.
The easiest approach would be to use Exporter::import, and stash that away and at the end, pass control to it:
use vars qw(@EXPORT $orig_import); use Exporter 'import'; sub my_import { print "Imported\n"; goto &$orig_import; }; BEGIN { # Install our own import routine over import: $orig_import= \&import; *import= \&my_import; };
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Redefined import method and EXPORT not working
by tobyink (Canon) on Dec 22, 2014 at 11:03 UTC | |
by Anonymous Monk on Jan 10, 2017 at 16:01 UTC | |
|
Re^2: Redefined import method and EXPORT not working
by Anonymous Monk on Dec 22, 2014 at 09:44 UTC | |
by Corion (Patriarch) on Dec 22, 2014 at 14:10 UTC |