3 # $Id: retrieve.t,v 1.0 2000/09/01 19:40:42 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.
10 # $Log: retrieve.t,v $
11 # Revision 1.0 2000/09/01 19:40:42 ram
12 # Baseline for first official release.
18 @INC = ('.', '../lib', '../ext/Storable/t');
22 require Config; import Config;
23 if ($ENV{PERL_CORE} and $Config{'extensions'} !~ /\bStorable\b/) {
24 print "1..0 # Skip: Storable was not built\n";
31 use Storable qw(store retrieve nstore);
38 $c->{attribute} = 'attrval';
39 %a = ('key', 'value', 1, 0, $a, $b, 'cvar', \$c);
40 @a = ('first', '', undef, 3, -4, -3.14159, 456, 4.5,
41 $b, \$a, $a, $c, \$c, \%a);
43 print "not " unless defined store(\@a, 'store');
45 print "not " if Storable::last_op_in_netorder();
47 print "not " unless defined nstore(\@a, 'nstore');
49 print "not " unless Storable::last_op_in_netorder();
51 print "not " unless Storable::last_op_in_netorder();
54 $root = retrieve('store');
55 print "not " unless defined $root;
57 print "not " if Storable::last_op_in_netorder();
60 $nroot = retrieve('nstore');
61 print "not " unless defined $nroot;
63 print "not " unless Storable::last_op_in_netorder();
71 print "not " unless $d1 eq $d2;
74 # Make sure empty string is defined at retrieval time
75 print "not " unless defined $root->[1];
77 print "not " if length $root->[1];
80 END { 1 while unlink('store', 'nstore') }