in reply to Printing the code of a coderef
You're looking for B::Deparse. In fact, you have the usage almost correct, except instead of printcode the method is called coderef2text.
use B::Deparse; sub somecode { do { print "some stuff\n" } } my $somevar = B::Deparse->new(); print $somevar->coderef2text(\&somecode);
However you might want to read the docs, as B::Deparse is still in development and contains some caveats.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Printing the code of a coderef
by Anonymous Monk on Jun 26, 2007 at 06:05 UTC | |
by sgt (Deacon) on Jun 26, 2007 at 13:08 UTC | |
by naikonta (Curate) on Jun 26, 2007 at 14:14 UTC |