Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"
 
PerlMonks  

Re: How to get code of the calling function or object

by Khen1950fx (Canon)
on Mar 26, 2011 at 08:47 UTC ( [id://895646]=note: print w/replies, xml ) Need Help??


in reply to How to get code of the calling function or object

Using Sub::Information:
#!perl use Modern::Perl; use Data::Dump::Streamer; use Sub::Information as => 'peek'; my $info = peek(\&fred); say "Name: ", $info->name; say "Package: ", $info->package; say "Filename: ", $info->file; say "Address: ", $info->address; say "Starts at line: ", $info->line; say "Variables: ", Dump($info->variables); say $info->code; say $info->dump; sub fred { my(@x) = @_; foreach (@x) { s/a/A/g if /a/; } };

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others chanting in the Monastery: (4)
As of 2024-04-19 01:15 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found