in reply to Re^6: Function name in a variable, can't recall the concept (introspection with ->can )
in thread Function name in a variable, can't recall the concept

Actually I don't understand the discussion anymore, if the OP was willing to inspect a class the natural solution would be ->can.

If he wasn't inspecting a class ->can would do the job, too.

Are there pathological cases where an approach might break?

Of course, this is Perl, with high flexibility to bend internals.

Cheers Rolf
(addicted to the Perl Programming Language :)
Wikisyntax for the Monastery FootballPerl is like chess, only without the dice

  • Comment on Re^7: Function name in a variable, can't recall the concept (introspection with ->can )

Replies are listed 'Best First'.
Re^8: Function name in a variable, can't recall the concept (introspection with ->can )
by ikegami (Patriarch) on Apr 19, 2019 at 09:03 UTC

    No, that's not true.

    If they're trying to resolve a method, then ->can is correct.

    If they're trying to resolve a sub, then ->can can fail

    The OP is looking for a sub.