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.
11 require Config; import Config;
12 if ($ENV{PERL_CORE} and $Config{'extensions'} !~ /\bStorable\b/) {
13 print "1..0 # Skip: Storable was not built\n";
20 use Storable qw(store retrieve nstore);
27 $c->{attribute} = 'attrval';
28 %a = ('key', 'value', 1, 0, $a, $b, 'cvar', \$c);
29 @a = ('first', '', undef, 3, -4, -3.14159, 456, 4.5,
30 $b, \$a, $a, $c, \$c, \%a);
32 print "not " unless defined store(\@a, 'store');
34 print "not " if Storable::last_op_in_netorder();
36 print "not " unless defined nstore(\@a, 'nstore');
38 print "not " unless Storable::last_op_in_netorder();
40 print "not " unless Storable::last_op_in_netorder();
43 $root = retrieve('store');
44 print "not " unless defined $root;
46 print "not " if Storable::last_op_in_netorder();
49 $nroot = retrieve('nstore');
50 print "not " unless defined $nroot;
52 print "not " unless Storable::last_op_in_netorder();
60 print "not " unless $d1 eq $d2;
63 # Make sure empty string is defined at retrieval time
64 print "not " unless defined $root->[1];
66 print "not " if length $root->[1];
69 END { 1 while unlink('store', 'nstore') }