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

Re: What package is the method in?

by bart (Canon)
on May 16, 2010 at 14:43 UTC ( [id://840225]=note: print w/replies, xml ) Need Help??


in reply to What package is the method in?

$foo->can will return a reference to a sub. All you still have to do is get the fully qualified name for the sub from that coderef. Sub::Identify should do the trick (though I haven't test it)...

What's more: I think it should be possible to extract both the file name and the line number for the source file.
Update: Oh yes it is possible, using B::svref_2object() just like the "Pure Perl" version of the above module, and you can find how in: Track the filename/line number of an anonymous coderef.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others romping around the Monastery: (4)
As of 2024-04-24 03:05 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found