Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
PerlMonks  

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

by LanX (Saint)
on Apr 20, 2019 at 18:21 UTC ( [id://1232835]=note: print w/replies, xml ) Need Help??


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

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1232835]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others chilling in the Monastery: (5)
As of 2024-04-25 13:45 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found