in reply to Coderef to String conversion?
You'll need to use B::Deparse for this; for instance:
use B::Deparse; use Data::Dumper; my $deparse = B::Deparse->new; print $deparse->coderef2text( sub{print 'Yeah'} )
As for Data::Dumper, the newest version (the one that came with 5.8.0; if you don't have it, get it from the CPAN) has an option called Deparse; turn it on, and it will use B::Deparse to stringify coderefs for you:
my $test = { test => 1, code => sub { print 'Yeah'; }, aref => [ qw(1 2 3 4 5) ], }; $Data::Dumper::Deparse = 1; print Dumper($test);
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Coderef to String conversion?
by joe++ (Friar) on Mar 08, 2003 at 09:43 UTC | |
by diotalevi (Canon) on Mar 08, 2003 at 14:18 UTC | |
by jryan (Vicar) on Mar 08, 2003 at 11:33 UTC |