1N/A# Copyright 2002, Larry Wall. 1N/A# You may redistribute only under the same terms as Perl 5, as specified 1N/A# in the README file that comes with the distribution. 1N/A# I ought to keep this test easily backwards compatible to 5.004, so no 1N/A# This test checks whether the kludge to interwork with 5.6 Storables compiled 1N/A# on Unix systems with IV as long long works. 1N/A chdir('t') if -d 't'; 1N/A print "1..0 # Skip: Storable was not built\n"; 1N/A print "1..0 # Skip: Your IVs are no larger than your longs\n"; 1N/A local $/ = "\n\nend\n"; 1N/A warn "Dodgy data in section starting '$_'"; 1N/A# perl makes easy things easy, and hard things possible: 1N/Amy $header = Storable::read_magic ($test); 1N/Ais ($header->{byteorder}, $Config{byteorder}, 1N/Amy $result = eval {thaw $test}; 1N/Aisa_ok ($result, 'SCALAR', "Check thawing test data"); 1N/Ais ($@, '', "causes no errors"); 1N/Amy $kingdom = $Config{byteorder} =~ /23/ ? "Lillput" : "Belfuscu"; 1N/Amy $name = join ',
', $kingdom, @$header{qw(intsize longsize ptrsize nvsize)}; 1N/A my $real_thing = $tests{$name}; 1N/A if (!defined $real_thing) { 1N/A# No test data for Storable 1.x for: 1N/A# sizeof(int) $$header{intsize} 1N/A# sizeof(long) $$header{longsize} 1N/A# sizeof(char *) $$header{ptrsize} 1N/A# sizeof(NV) $$header{nvsize} 1N/A# If you have Storable 1.x built with perl 5.6.x on this platform, please 1N/A# interworking problems, in which case you need do nothing. 1N/A my $result = eval {thaw $real_thing}; 1N/A is ($result, undef, "By default should not be able to thaw"); 1N/A "because the header byte order strings differ"); 1N/A local $Storable::interwork_56_64bit = 1; 1N/A $result = eval {thaw $real_thing}; 1N/A isa_ok ($result, 'ARRAY', "With flag should now thaw"); 1N/A is ($@, '', "with no errors"); 1N/A # However, as the file is written with Storable pre 2.01, it's a
known 1N/A # bug that large (positive) UVs become IVs 1N/Ais ($@, '', " causes no errors");
1N/Amy $header_kludge = Storable::read_magic ($test_kludge); 1N/Acmp_ok (length ($header_kludge->{byteorder}), '==', $Config{longsize}, 1N/A "With 5.6 interwork kludge byteorder string should be same size as long" 1N/A$result = eval {thaw $test_kludge}; 1N/Ais ($result, undef, "By default should not be able to thaw"); 1N/A "because the header byte order strings differ"); 1N/A$result = eval {thaw $test}; 1N/Aisa_ok ($result, 'SCALAR', "CHORUS: check thawing test data"); 1N/Ais ($@, '', " causes no errors"); 1N/Ais ($$result, 'Hell', " and gives the expected data"); 1N/A local $Storable::interwork_56_64bit = 1; 1N/A $result = eval {thaw $test_kludge}; 1N/A isa_ok ($result, 'SCALAR', "should be able to thaw kludge data"); 1N/A is ($@, '', "with no errors"); 1N/A is ($$result, 'Heck', "and gives expected data"); 1N/A $result = eval {thaw $test}; 1N/A# A whole run of 1.1.14 freeze data, uuencoded. The "mode bits" are the octal 1N/A# with a copy of Storable 1.X generate these. 1N/Abegin 101 Lillput,4,4,4,8 1N/AM!`0$,3(S-`0$!`@"!`````HQ5&AI<R!F:6QE('=A<R!W<FET=&5N('=I=&@@ 1N/AM,2XP,30@;VX@<&5R;"`U+C`P-C`P,0H33&EL;'!U="!W87,@8V]R<F5C=`8" 1N/AM!`0$-#,R,00$!`@"````!`HQ5&AI<R!F:6QE('=A<R!W<FET=&5N('=I=&@@ 1N/A1@`````````(*!U1H92!%;F0` 1N/AM!`0$,3(S-`0$!`P"!`````HQ5&AI<R!F:6QE('=A<R!W<FET=&5N('=I=&@@ 1N/AM,2XP,30@;VX@<&5R;"`U+C`P-C`P,0H33&EL;'!U="!W87,@8V]R<F5C=`8"