in reply to Re: defined &{ $pkg . '::foo' } vs. $pkg->can( 'foo' )
in thread defined &{ $pkg . '::foo' } vs. $pkg->can( 'foo' )

You almost always want to use exists &subname rather than defined &subname; there's no advantage in excluding declared-but-not-defined subs.

Hmmm... I don't see how including declared-but-not-defined subs could be a good idea either for the particular application I had in mind or for the one I cited.

the lowliest monk

  • Comment on Re^2: defined &{ $pkg . '::foo' } vs. $pkg->can( 'foo' )

Replies are listed 'Best First'.
Re^3: defined &{ $pkg . '::foo' } vs. $pkg->can( 'foo' )
by ysth (Canon) on Jul 15, 2005 at 20:26 UTC
    I don't see why. Pre-declaring subs is the responsible way to use AUTOLOAD. Why would you want to disallow it in your delegatees? Anyway, this qualifies as a difference between ->can and defined&.

      Pre-declaring subs is the responsible way to use AUTOLOAD.

      I wasn't aware of this convention. Good to know. Thanks.

      the lowliest monk