3 # Copyright (c) 1995-2000, Raphael Manfredi
5 # You may redistribute only under the same terms as Perl 5, as specified
6 # in the README file that comes with the distribution.
12 @INC = ('.', '../lib', '../ext/Storable/t');
16 require Config; import Config;
17 if ($ENV{PERL_CORE} and $Config{'extensions'} !~ /\bStorable\b/) {
18 print "1..0 # Skip: Storable was not built\n";
25 use Storable qw(freeze nfreeze thaw);
37 %a = ('key', 'value', 1, 0, $a, $b, 'cvar', \$c);
38 @a = ('first', undef, 3, -4, -3.14159, 456, 4.5, $d, \$d, \$e, $e,
39 $b, \$a, $a, $c, \$c, \%a);
41 print "not " unless defined ($f1 = freeze(\@a));
48 print "not " unless defined $root;
54 print "not " unless $got eq $dumped;
57 package FOO; @ISA = qw(Storable);
61 $self->{key} = \%main::a;
68 print "not " unless $f2 = $foo->freeze;
71 print "not " unless $f3 = $foo->nfreeze;
75 print "not " unless defined $root3;
78 print "not " unless &dump($foo) eq &dump($root3);
82 print "not " unless &dump($foo) eq &dump($root);
85 print "not " unless &dump($root3) eq &dump($root);
88 $other = freeze($root);
89 print "not " unless length($other) == length($f2);
92 $root2 = thaw($other);
93 print "not " unless &dump($root2) eq &dump($root);
100 'SELECT table_name, table_owner, num_rows FROM iitables
101 where table_owner != \'$ingres\' and table_owner != \'DBA\''
106 print "not " unless $VAR2->[3] eq $VAR1->[3];
109 # Test the workaround for LVALUE bug in perl 5.004_04 -- from Gisle Aas
110 sub foo { $_[0] = 1 }
113 eval { freeze($foo) };
117 # Test cleanup bug found by Claudio Garcia -- RAM, 08/06/2001
118 my $thaw_me = 'asdasdasdasd';
121 my $thawed = thaw $thaw_me;
125 my %to_be_frozen = (foo => 'bar');
128 $frozen = freeze \%to_be_frozen;
133 eval { thaw $thaw_me };
134 eval { $frozen = freeze { foo => {} } };
137 thaw $frozen; # used to segfault here