Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling
 
PerlMonks  

Re: Printing the code of a coderef

by ferreira (Chaplain)
on Jun 26, 2007 at 13:43 UTC ( #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? | Other CB clients
Other Users?
Others avoiding work at the Monastery: (2)
As of 2023-01-27 02:00 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?