in reply to referring to packages indirectly

This minor modification worked for me:
eval { no strict "refs"; require "$fqn_file"; local $SIG{'__DIE__'}; ###$ref = $foo->can('f_preferred') ? \&{$foo . "::f_preferred" +} : undef; $ref = $foo->can('f_preferred'); };
Read up on UNIVERSAL for more info.

Update: I too needed to read up on UNIVERSAL, as can does exactly what the OP was looking for without my redundant ternary operator.

---
It's all fine and dandy until someone has to look at the code.

Replies are listed 'Best First'.
Re^2: referring to packages indirectly
by chromatic (Archbishop) on Oct 11, 2006 at 23:39 UTC

    Be careful with that, as can() searches all parent classes for the subroutine. That might not be what you want.