I\'m currently working in a very complex Perl architecture, and I want to create some debugging tools. Since a lot of the behavior involves anonymous subroutines, I\'d like to a
Yeah, Data::Dumper
can be told to bring in B::Deparse
, via something like:
#!/usr/bin/perl
use Data::Dumper;
use strict;
use warnings;
$Data::Dumper::Deparse = 1;
my $code = sub { my $a = 42; print $a ** 2; };
print Dumper $code;
There is an object-oriented interface as well (described in the perldoc for Data::Dumper
), if you prefer.
Note: The code that is output won't be identical to what you originally specified, but it will have the same semantics.