use 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);