I just went looking for how Data::Dumper does this, and it seems the core solution is:
use B::Deparse; ... my $string = B::Deparse->new->coderef2text($coderef);
In reply to Re^2: Converting a coderef back to code
by oxone
in thread Converting a coderef back to code
by oxone
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |