in reply to Data::Dumper segfaulting.

A work around may be to use Data::Dump::Streamer instead:

#!/usr/bin/perl -w use Encode; use utf8; use Data::Dump::Streamer; #$Data::Dumper::Useperl = 1; my $string = 'ä, ö, ü / Ä, Ö, Ü, ß ¿Adónde vas?'; $string = encode_utf8( $string ) ; my $print_count = 1; my $hash = { key => $string }; my $tmp = Dump ($hash)->Out (); print "1:$tmp\n"; # Turning $Data::Dumper::Userperl to 0 causes a segfault in the second + dumper; $hash = eval $tmp; print "Value is : $hash->{key}\n"; $tmp = Dump ($hash)->Out (); print "2:$tmp\n"; $hash = eval $tmp; print "Value is : $hash->{key}\n"; $tmp = Dump ($hash)->Out(); print "2:$tmp\n";

Prints:

Subroutine B::SV::object_2svref redefined at C:/Perl/lib/DynaLoader.pm + line 253. 1:$HASH1 = { key => "\344, \366, \374 / \304, \326, \334, \337 \277Ad\ +363nde vas?" }; Value is : ä, ö, ü / Ä, Ö, Ü, ß ¿Adónde vas? 2:$HASH1 = { key => "\344, \366, \374 / \304, \326, \334, \337 \277Ad\ +363nde vas?" }; Value is : ä, ö, ü / Ä, Ö, Ü, ß ¿Adónde vas? 2:$HASH1 = { key => "\344, \366, \374 / \304, \326, \334, \337 \277Ad\ +363nde vas?" };

DWIM is Perl's answer to Gödel

Replies are listed 'Best First'.
Re^2: Data::Dumper segfaulting.
by nabeel (Novice) on Apr 16, 2007 at 10:57 UTC
    Thanks for the quick reply , I just had a look at Data::Dumper::Streamer. The only thing is, I need to use Data::Dumper ( or something like it) in a core part of a large system which is used VERY often, so I liked the fact that the xs version of dumper was fast (well faster than the perl version ). I haven't done any benchmarking on Data::Dumper::Streamer but the documentation I think said that it sacrificed speed for memory whereas I am happy to go the other way :-). But still might be worth a try as it seems to be dealing with the high bit characters well. Nabeel