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

> You're suggesting that we use

>  my $sub = @{ get_array_by_name($pkg, 'ISA') } ? get_sub_by_name($pkg, $name) : $pkg->can($name);

No, I don't!

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 )
  • Download Code

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 21, 2019 at 13:13 UTC

    uh, then feel free to clarify why you meant by "one can easily check @ISA".

      I already explained.

      But feel free to describe a use case where one might be interested to only call the non-inherited methods of a class, and this without prior knowledge about its OOP nature.

      In this light try to read again the OP which uses it's own well known package like a "dispatch" table for ordinary functions.

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