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;
In reply to Re: Printing the code of a coderef
by ferreira
in thread Printing the code of a coderef
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |