Skip to content

Commit

Permalink
Deal with class names containing '=' [RT#72415]
Browse files Browse the repository at this point in the history
  • Loading branch information
gisle committed Feb 11, 2012
1 parent 77a8218 commit f00c47d
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
2 changes: 1 addition & 1 deletion lib/Data/Dump.pm
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ sub _dump
my($class, $type, $id);
my $strval = overload::StrVal($rval);
# Parse $strval without using regexps, in order not to clobber $1, $2,...
if ((my $i = index($strval, "=")) >= 0) {
if ((my $i = rindex($strval, "=")) >= 0) {
$class = substr($strval, 0, $i);
$strval = substr($strval, $i+1);
}
Expand Down
3 changes: 2 additions & 1 deletion t/dump.t
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

use strict;
use Test qw(plan ok);
plan tests => 33;
plan tests => 34;

use Data::Dump qw(dump);

Expand Down Expand Up @@ -64,3 +64,4 @@ EOT
# stranger stuff
ok(dump({ a => \&Data::Dump::dump, aa => do {require Symbol; Symbol::gensym()}}),
"do {\n require Symbol;\n { a => sub { ... }, aa => Symbol::gensym() };\n}");
ok(dump(bless{}, "foo=bar"), 'bless({}, "foo=bar")');

0 comments on commit f00c47d

Please sign in to comment.