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.
8 # Original Author: Ulrich Pfeifer
9 # (C) Copyright 1997, Universitat Dortmund, all rights reserved.
15 @INC = ('.', '../lib');
20 if ($File::Spec::VERSION < 0.8) {
21 print "1..0 # Skip: newer File::Spec needed\n";
24 require Config; import Config;
25 if ($ENV{PERL_CORE} and $Config{'extensions'} !~ /\bStorable\b/) {
26 print "1..0 # Skip: Storable was not built\n";
31 use Storable qw(store retrieve);
37 *GLOB = *GLOB; # peacify -w
38 my $bad = ['foo', \*GLOB, 'bar'];
41 eval {$result = store ($bad , 'store')};
42 print ((!defined $result)?"ok $test\n":"not ok $test\n"); $test++;
43 print (($@ ne '')?"ok $test\n":"not ok $test\n"); $test++;
45 $Storable::forgive_me=1;
47 my $devnull = File::Spec->devnull;
49 open(SAVEERR, ">&STDERR");
50 open(STDERR, ">$devnull") or
51 ( print SAVEERR "Unable to redirect STDERR: $!\n" and exit(1) );
53 eval {$result = store ($bad , 'store')};
55 open(STDERR, ">&SAVEERR");
57 print ((defined $result)?"ok $test\n":"not ok $test\n"); $test++;
58 print (($@ eq '')?"ok $test\n":"not ok $test\n"); $test++;
60 my $ret = retrieve('store');
61 print ((defined $ret)?"ok $test\n":"not ok $test\n"); $test++;
62 print (($ret->[0] eq 'foo')?"ok $test\n":"not ok $test\n"); $test++;
63 print (($ret->[2] eq 'bar')?"ok $test\n":"not ok $test\n"); $test++;
64 print ((ref $ret->[1] eq 'SCALAR')?"ok $test\n":"not ok $test\n"); $test++;
67 END { 1 while unlink 'store' }