New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Data::Dumper mangles dualvars #7238
Comments
From zefram@fysh.orgCreated by zefram@fysh.orgI'm working with Data::Dumper version 2.121 for this bug report. Data::Dumper, if given a dualvar (such as $!), only dumps the string Inline Patch--- /usr/lib/perl/5.8.3/Data/Dumper.pm 2004-03-27 06:52:27.000000000 +0000
+++ Dumper.pm 2004-04-15 19:22:43.000000000 +0100
@@ -449,17 +449,25 @@
elsif (!defined($val)) {
$out .= "undef";
}
- elsif ($val =~ /^(?:0|-?[1-9]\d{0,8})\z/) { # safe decimal number
- $out .= $val;
- }
- else { # string
+ else { # string/number
+ my $strval;
if ($s->{useqq} or $val =~ tr/\0-\377//c) {
# Fall back to qq if there's unicode
- $out .= qquote($val, $s->{useqq});
+ $strval = qquote($val, $s->{useqq});
}
else {
$val =~ s/([\\\'])/\\$1/g;
- $out .= '\'' . $val . '\'';
+ $strval = '\'' . $val . '\'';
+ }
+ no warnings "numeric";
+ if(0+$val eq $val) {
+ $out .= 0+$val;
+ }
+ elsif("$val" == $val) {
+ $out .= $strval;
+ }
+ else {
+ $out .= "dualvar(".(0+$val).", ".$strval.")";
}
}
}
$ perl -MData::Dumper -we '$Data::Dumper::Useqq=1; print Dumper($!)' Both before and after the patch, the code has a problem with floating See also bug #28538 for the discussion of dualvars that led to this Perl Info
|
From @hvdsZefram (via RT) <perlbug-followup@perl.org> wrote: Hmm, that should probably be: Hugo |
The RT System itself - Status changed from 'new' to 'open' |
From @demerphq
FWIW I agree that Data::Dumper should probably have this. However I have Currently Data::Dumper doesnt use subs to do its thing at all. Other dumpers Anyway, I dont claim that my choices are correct here but I think its worth Also, I seem to recall that Scalar::Util::dualvar doesnt work on some And once all these policies are decided there are a whole host of attributes Food for thought. |
From @rgsOrton, Yves wrote:
I share these; Data::Dumper is a simple and a fast tool ; IMHO a ...
|
From @demerphq
For the record the only one of the below that Data::Dump::Streamer doesnt Regarding Speed. DDS is a lot slower than DD. BUT, I believe that many or
|
@iabyn - Status changed from 'open' to 'rejected' |
Migrated from rt.perl.org#28839 (status was 'rejected')
Searchable as RT28839$
The text was updated successfully, but these errors were encountered: