in reply to Checking if a subroutine has been defined in a package...
CAVEAT: this is off the cuff and untested...
Consider:
That is, bless something into the namespace you are checking and use that object to try 'can' against.my $foo = bless {}, 'package::name'; $foo->can('function');
UPDATE:
Reading Re: Re (tilly) 1: Strict, strings and subroutines by merlyn, I see where this needs to not search ISA, leading (by way of cribbing)
do { local @ISA; my $foo = bless {}, 'package::name'; $foo->can('function'); };
yours,
Michael
|
|---|