no eval needed with no strict 'refs';
use strict; use warnings; package FP; sub AUTOLOAD { our $AUTOLOAD; print "hello $AUTOLOAD\n" } my @pkgs =qw/BLA BLUB MyHomepage::Introduction/; for my $PKG (@pkgs) { no strict 'refs'; *{ "${PKG}::AUTOLOAD" } = \&FP::AUTOLOAD } BLA::bla(); MyHomepage::Introduction::intro();
hello BLA::bla hello MyHomepage::Introduction::intro
But I already suggested Importing in my first reply ...
*${packagename)::AUTOLOAD = \&FP::AUTOLOAD; ^
Cheers Rolf
(addicted to the Perl Programming Language :)
Wikisyntax for the Monastery
In reply to Re^10: Use of inherited AUTOLOAD for non-method is no longer allowed with Perl 5.34.
by LanX
in thread Use of inherited AUTOLOAD for non-method is no longer allowed with Perl 5.34.
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |