Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery
 
PerlMonks  

Re: Printing the code of a coderef

by ferreira (Chaplain)
on Jun 26, 2007 at 13:43 UTC ( [id://623402]=note: print w/replies, xml ) Need Help??


in reply to Printing the code of a coderef

A very recent module which can help you with this is Sub::Information. To tell the truth, it uses B::Deparse (via Data::Dump::Streamer) to get the source code, but its rationale is to bring together a bunch of modules which collect information about code and offer a nice integrated API.

sub somecode { do { print "some stuff\n" } } use Sub::Information as => 'inspect'; my $code_info = inspect(\&somecode); print $code_info->code;

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others perusing the Monastery: (6)
As of 2024-04-23 19:34 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found