Skip Menu |

Preferred bug tracker

Please visit the preferred bug tracker to report your issue.

This queue is for tickets about the Data-Dumper CPAN distribution.

Report information
The Basics
Id: 21311
Status: new
Priority: 0/
Queue: Data-Dumper

People
Owner: Nobody in particular
Requestors: tom+cpan [...] iplod.net
Cc:
AdminCc:

Bug Information
Severity: Wishlist
Broken in: (no value)
Fixed in: (no value)



Subject: Make Data::Dumper handle LVALUE refs
Data::Dumper currently does not handle LVALUE references. I propose that it does. :) The change below works when using the pure-Perl implementation of Data::Dumper but I'm unable to make the change to the XS version. Regards, Tom --- Dumper.pm.bak 2006-06-14 17:10:01.000000000 +0930 +++ Dumper.pm 2006-09-04 14:06:10.000000000 +0930 @@ -316,7 +318,7 @@ $s->{level}++; $ipad = $s->{xpad} x $s->{level}; - if ($realtype eq 'SCALAR' || $realtype eq 'REF') { + if ($realtype eq 'SCALAR' || $realtype eq 'REF' || $realtype eq 'LVALUE') { if ($realpack) { $out .= 'do{\\(my $o = ' . $s->_dump($$val, "\${$name}") . ')}'; } @@ -445,10 +447,11 @@ if ($s->{purity}) { my $k; local ($s->{level}) = 0; - for $k (qw(SCALAR ARRAY HASH)) { + for $k (qw(SCALAR ARRAY LVALUE HASH)) { my $gval = *$val{$k}; next unless defined $gval; next if $k eq "SCALAR" && ! defined $$gval; # always there + next if $k eq "LVALUE" && ! defined $$gval; # always there # _dump can push into @post, so we hold our place using $postlen my $postlen = scalar @post;
Of course a patch within an RT ticket was a stupid idea. File attached. Tom.
--- Dumper.pm.bak 2006-06-14 17:10:01.000000000 +0930 +++ Dumper.pm 2006-09-04 14:06:10.000000000 +0930 @@ -316,7 +318,7 @@ $s->{level}++; $ipad = $s->{xpad} x $s->{level}; - if ($realtype eq 'SCALAR' || $realtype eq 'REF') { + if ($realtype eq 'SCALAR' || $realtype eq 'REF' || $realtype eq 'LVALUE') { if ($realpack) { $out .= 'do{\\(my $o = ' . $s->_dump($$val, "\${$name}") . ')}'; } @@ -445,10 +447,11 @@ if ($s->{purity}) { my $k; local ($s->{level}) = 0; - for $k (qw(SCALAR ARRAY HASH)) { + for $k (qw(SCALAR ARRAY LVALUE HASH)) { my $gval = *$val{$k}; next unless defined $gval; next if $k eq "SCALAR" && ! defined $$gval; # always there + next if $k eq "LVALUE" && ! defined $$gval; # always there # _dump can push into @post, so we hold our place using $postlen my $postlen = scalar @post;