Skip Menu |

This queue is for tickets about the Class-Std CPAN distribution.

Report information
The Basics
Id: 37788
Status: new
Priority: 0/
Queue: Class-Std

People
Owner: Nobody in particular
Requestors: MCWEHNER [...] cpan.org
Cc: mcwehner [...] gmail.com
AdminCc:

Bug Information
Severity: Normal
Broken in:
  • 0.0.9
  • v0.0.8
Fixed in: (no value)



CC: mcwehner [...] gmail.com
Subject: _DUMP method will produce corrupt output with newlines in attribute values.
When using the _DUMP method of an object built using Class::Std, if any of the attribute values for the object contains newlines, the output of _DUMP will be corrupt. I've traced this to the very end of the _DUMP method, which compiles a hash, feeds it to Data::Dumper::Dumper, removes the typical `$VAR = ' prefix, and returns the final string value: require Data::Dumper; my $dump = Data::Dumper::Dumper(\%dump); $dump =~ s/^.{8}//gxms; return $dump; The use of `gxms' removes Data::Dumper::Dumper's usual prefixing of `$VAR = ' from the string, but will also remove 8-character segments of the output string (contained in $dump) where an attribute value contains newlines. One simple test for this is to create a class using Class::Std, assign a string value containing a newline, and then eval the _DUMP'd output. This will fail. Since it seems like the only purpose of the substitution on the _DUMP'd value is to remove Data::Dumper's prefixing of `$VAR = ', the options `gxms' are probably unnecessary.