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: 48275
Status: resolved
Priority: 0/
Queue: Data-Dumper

People
Owner: Nobody in particular
Requestors: chm [...] cpan.org
Cc:
AdminCc:

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



Subject: Data::Dumper::Dump returns lexical variable with minus sign in name
This problem report is reference to this CPAN Testers report for PDL: http://www.nntp.perl.org/group/perl.cpan.testers/2009/07/msg4806234.html The PDL test for PDL::IO::Dumper uses Data::Dumper::Dump as a first pass to construct a valid dump file for PDL objects. Here is an example of the Dump::Dumper::Dump output that is expected: print Data::Dumper->Dumpperl([{a=>3,b=>pdl(4),c=>xvals(3,3),d=>xvals (4,4)}]); $VAR1 = { 'c' => bless( do{\(my $o = 8181704)}, 'PDL' ), 'a' => 3, 'b' => bless( do{\(my $o = 8179968)}, 'PDL' ), 'd' => bless( do{\(my $o = 9281920)}, 'PDL' ) }; Which is then massaged into this (correct code): print $s = sdump({a=>3,b=>pdl(4),c=>xvals(3,3),d=>xvals(4,4)}); {my($VAR1); my($PDL_8177104) = (double(0,1,2,0,1,2,0,1,2)->reshape(3,3)); my($PDL_12634208) = (double(0,1,2,3,0,1,2,3,0,1,2,3,0,1,2,3)->reshape (4,4)); $VAR1 = { 'c' => $PDL_8177104, 'a' => 3, 'b' => ( double(4) ), 'd' => $PDL_12634208 }; } However, for the test reported, the output of Data::Dumper::Dump (a.k.a. Dumpperl) is: # Failed test 'Can eval dumped data code' # at t/dumper.t line 49. # The output string was '{my($VAR1); # my($PDL_-1151577840) = (double(0,1,2,0,1,2,0,1,2)->reshape(3,3)); # my($PDL_-1151577664) = (double(0,1,2,3,0,1,2,3,0,1,2,3,0,1,2,3)- Show quoted text
>reshape(4,4));
# # # $VAR1 = { # 'c' => bless( do{\(my $o = '-1151577840')}, 'PDL' ), # 'a' => 3, # 'b' => bless( do{\(my $o = '-1151578016')}, 'PDL' ), # 'd' => bless( do{\(my $o = '-1151577664')}, 'PDL' ) # }; # # }' Note the generation of lexical variables named $PDL_-1151577840 which is not a valid variable name. I looked at the Data::Dumper version 2.121_08 code and saw that the name is constructed using $Config::Config{uvxformat} so it appears the perl in the test may be using an older version of Data::Dumper. If this used to be a problem, do you know what version of Data::Dumper fixed the problem? Thanks much, Chris
Hi Chris, since what you write essentially means the problem is fixed in recent releases of Data::Dumper, I'm closing this ticket. If I misread your bug report and it's really the other way around, please reply and the ticket will be reopened automatically. It seems that 2.122 was the first *stable* Data::Dumper release which uses uses uvxformat. Best regards, Steffen PS: If you declare a dependency on Data::Dumper from PDL (despite it being core), CPAN testers output should include the version of Data::Dumper that was used for the testing. If you're unsure which version of Data::Dumper included the fix, you could start by depending on DD version 0 and then narrow things down depending on which versions fail and which don't. But if I were you, I wouldn't bother and simply rely on a recent version of DD. After all, if a user can compile PDL, he can certainly compile a new version of Data::Dumper!