Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation
 
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
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 meditating upon the Monastery: (3)
As of 2020-10-20 01:07 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    My favourite web site is:












    Results (208 votes). Check out past polls.

    Notices?