in reply to Re^7: Exporter. Correct way to override import?
in thread Exporter. Correct way to override import?
package myModule; require XYZ; sub import { XYZ->import("function") } 1;
should import XYZ::function if you use MyModule
Sorry seems only to work for pragmas ... the code in Modern::Perl is confusing me...
package myModule; use strict; use warnings; require Data::Dump; sub import { my $target_pkg = (caller)[0]; no strict 'refs'; for my $func ( qw/dd pp/) { *{"$target_pkg::$func"}= \&{"Data::Dump::$func"}; } } 1;
Cheers Rolf
(addicted to the Perl Programming Language and ☆☆☆☆ :)
Wikisyntax for the Monastery
|
|---|