Data-Dump-Streamer
view release on metacpan or search on metacpan
Reworked how objects blessed into classes with overloads are handled to prevent
any overloaded methods from firing during the eval of their dump. There may be
problems with this and the Freeze/Thaw processing so YMMV. Thanks to [diotalevi]
from perlmonks for the base implementation of this.
Added support for weakreferences. Under some circumstances weakrefs caused DDS
to get very confused, and there was no support for recreating weakrefs in the
structure. This has been rectified. Its possible that output including weakrefs
may not eval correctly as the restored data may be missing external references
that keep the overall data structure alive. For instance if everything in the
dump is a weakref the resulting vars may have returned to undef prior to completing
the eval. YMMV. Thanks to [ysth] from perlmonks for the pointer to how weakrefs work.
Added method behaviour to Dump() so its not just subroutine based. This should make
using it as a method more or less DWIM. Also thanks to [diotalevi]
Added support for dumping the lexical context of CODE refs. Heavily experimental,
YMMV.
1.10
lib/Data/Dump/Streamer.pm view on Meta::CPAN
$self->{style}{deparse}
&& $self->{style}{deparseglob}
#and defined *$lhs{FORMAT}
) {
# from link from [ysth]: http://groups.google.com/groups?selm=laUs8gzkgOlT092yn%40efn.org
# translate arg (or reference to it) into a B::* object
# To work-around perl commit
# 2acc3314e31a9342e325f35c5b592967c9850c9b, keep the
# value \*$lhs alive while we inspect it as a B object
# or else it'll be reaped while we're using it.
my $lhs_glob= \*$lhs;
my $Bobj= B::svref_2object($lhs_glob);
# if passed a glob or globref, get the format
$Bobj= B::GV::FORM($Bobj) if ref $Bobj eq 'B::GV';
if (ref $Bobj eq 'B::FM') {
(my $cleaned= $name) =~ s/^\*(::)?//;
$self->{fh}->print("format $cleaned =\n");
t/madness_w.t view on Meta::CPAN
}
{
skip("Causes error at global destruction on 5.8.0", 1)
if $] == 5.008;
#local $Data::Dump::Streamer::DEBUG = 1;
my $x;
$x= sub { \@_ }
->($x, $x);
my $y= $x; #keep it alive
weaken($x);
push @$x, $x;
same("Tye Alias Array", $o, <<'EXPECT', ($x));
$ARRAY1 = [
'A: $ARRAY1',
'A: $ARRAY1',
'V: $ARRAY1'
];
alias_av(@$ARRAY1, 0, $ARRAY1);
alias_av(@$ARRAY1, 1, $ARRAY1);
( run in 1.943 second using v1.01-cache-2.11-cpan-39bf76dae61 )