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(store retrieve nstore);
32 $c->{attribute} = 'attrval';
33 %a = ('key', 'value', 1, 0, $a, $b, 'cvar', \$c);
34 @a = ('first', '', undef, 3, -4, -3.14159, 456, 4.5,
35 $b, \$a, $a, $c, \$c, \%a);
37 print "not " unless defined store(\@a, 'store');
39 print "not " if Storable::last_op_in_netorder();
41 print "not " unless defined nstore(\@a, 'nstore');
43 print "not " unless Storable::last_op_in_netorder();
45 print "not " unless Storable::last_op_in_netorder();
48 $root = retrieve('store');
49 print "not " unless defined $root;
51 print "not " if Storable::last_op_in_netorder();
54 $nroot = retrieve('nstore');
55 print "not " unless defined $nroot;
57 print "not " unless Storable::last_op_in_netorder();
65 print "not " unless $d1 eq $d2;
68 # Make sure empty string is defined at retrieval time
69 print "not " unless defined $root->[1];
71 print "not " if length $root->[1];
74 END { 1 while unlink('store', 'nstore') }