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.
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(store retrieve nstore);
35 $c->{attribute} = 'attrval';
36 %a = ('key', 'value', 1, 0, $a, $b, 'cvar', \$c);
37 @a = ('first', '', undef, 3, -4, -3.14159, 456, 4.5,
38 $b, \$a, $a, $c, \$c, \%a);
40 print "not " unless defined store(\@a, 'store');
42 print "not " if Storable::last_op_in_netorder();
44 print "not " unless defined nstore(\@a, 'nstore');
46 print "not " unless Storable::last_op_in_netorder();
48 print "not " unless Storable::last_op_in_netorder();
51 $root = retrieve('store');
52 print "not " unless defined $root;
54 print "not " if Storable::last_op_in_netorder();
57 $nroot = retrieve('nstore');
58 print "not " unless defined $nroot;
60 print "not " unless Storable::last_op_in_netorder();
68 print "not " unless $d1 eq $d2;
71 # Make sure empty string is defined at retrieval time
72 print "not " unless defined $root->[1];
74 print "not " if length $root->[1];
77 END { 1 while unlink('store', 'nstore') }