I started doing something like this after I came across a node a while back. I cannot find the link to the node now.
My test code was
use B::Deparse; my $sr = sub { print "Hello\n" }; $sr->(); my $code = B::Deparse->new->coderef2text($sr); $code =~ s/print \s\S+/die "Bye";/; $sr = eval "sub $code"; $sr->();
In reply to Re^4: How to get code of the calling function or object
by tmaly
in thread How to get code of the calling function or object
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |