Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions Makefile.PL
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ WriteMakefile(
MIN_PERL_VERSION => 5.006,
PREREQ_PM => {
Symbol => 0,
'Scalr::Util' => 0,
},
META_MERGE => {
resources => {
Expand All @@ -21,6 +22,7 @@ WriteMakefile(
},
BUILD_REQUIRES => {
Test => 0,
B => 0,
},
);

Expand Down
3 changes: 2 additions & 1 deletion lib/Data/Dump.pm
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ require Exporter;
$VERSION = "1.22";
$DEBUG = 0;

use Scalar::Util qw/looks_like_number/;
use overload ();
use vars qw(%seen %refcnt @dump @fixup %require $TRY_BASE64 @FILTERS $INDENT);

Expand Down Expand Up @@ -229,7 +230,7 @@ sub _dump
if (!defined $$rval) {
$out = "undef";
}
elsif (do {no warnings 'numeric'; $$rval + 0 eq $$rval}) {
elsif (looks_like_number($$rval) && $$rval + 0 eq $$rval) {
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will still convert a string that looks like a number into a number.

$out = $$rval;
}
else {
Expand Down
14 changes: 14 additions & 0 deletions t/sv-flags.t
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
use strict;

use Test qw(plan ok);

plan tests => 2;

use B;
use Data::Dump qw(dump);

my $c = "abc";
my $orig_flags = B::svref_2object(\$c)->FLAGS;
ok(dump($c), qq("abc"));
ok B::svref_2object(\$c)->FLAGS, $orig_flags;