Thenuse v5.36; package Foo::Internal { use Scalar::Util 'looks_like_number'; sub check_it ($self, $num) { say 'Hoorah!' if looks_like_number($num); } } package Foo { sub new ($class) { bless {} => $class; } no warnings 'once'; *check_it = \&Foo::Internal::check_it; } my $foo = Foo->new; $foo->check_it(42); $foo->looks_like_number(42);
% perl internal.pl Hoorah! Can't locate object method "looks_like_number" via package "Foo" at in +ternal.pl line 22.
In reply to Re: Pure perl lexical sub import
by Arunbear
in thread Pure perl lexical sub import
by NERDVANA
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |