3 # $Id: freeze.t,v 1.0 2000/09/01 19:40:41 ram Exp $
5 # Copyright (c) 1995-2000, Raphael Manfredi
7 # You may redistribute only under the same terms as Perl 5, as specified
8 # in the README file that comes with the distribution.
11 # Revision 1.0 2000/09/01 19:40:41 ram
12 # Baseline for first official release.
19 require Config; import Config;
20 if ($Config{'extensions'} !~ /\bStorable\b/) {
21 print "1..0 # Skip: Storable was not built\n";
24 require 'lib/st-dump.pl';
28 use Storable qw(freeze nfreeze thaw);
40 %a = ('key', 'value', 1, 0, $a, $b, 'cvar', \$c);
41 @a = ('first', undef, 3, -4, -3.14159, 456, 4.5, $d, \$d, \$e, $e,
42 $b, \$a, $a, $c, \$c, \%a);
44 print "not " unless defined ($f1 = freeze(\@a));
51 print "not " unless defined $root;
57 print "not " unless $got eq $dumped;
60 package FOO; @ISA = qw(Storable);
64 $self->{key} = \%main::a;
71 print "not " unless $f2 = $foo->freeze;
74 print "not " unless $f3 = $foo->nfreeze;
78 print "not " unless defined $root3;
81 print "not " unless &dump($foo) eq &dump($root3);
85 print "not " unless &dump($foo) eq &dump($root);
88 print "not " unless &dump($root3) eq &dump($root);
91 $other = freeze($root);
92 print "not " unless length($other) == length($f2);
95 $root2 = thaw($other);
96 print "not " unless &dump($root2) eq &dump($root);
103 'SELECT table_name, table_owner, num_rows FROM iitables
104 where table_owner != \'$ingres\' and table_owner != \'DBA\''
109 print "not " unless $VAR2->[3] eq $VAR1->[3];
112 # Test the workaround for LVALUE bug in perl 5.004_04 -- from Gisle Aas
113 sub foo { $_[0] = 1 }
116 eval { freeze($foo) };