stasis-aries-wal/lang/perl/t/06-open.t
Sears Russell 5d0500dc7a Perl updates:
- Cleaned up initialization and shutdown.
 - Add support for autocommitted hashes
 - Wrote preliminary perldocs
 - Updated sample cgi scripts. 
 - Added new (partial) wiki thing
 - Added stasis.pl (a simple toplevel)
2010-02-17 05:05:23 +00:00

33 lines
No EOL
505 B
Perl

#!/usr/bin/perl -w
use strict;
use Stasis;
my $checking;
if(@ARGV && $ARGV[0] eq "--automated-test") {
shift @ARGV;
system ("rm storefile.txt logfile.txt");
$checking = 1;
}
my %hash;
Stasis::open (\%hash);
for(my $i = 0; $i < 4; $i++) {
$hash{$i} = $i * 10;
if($i % 2) {
tied(%hash)->commit();
} else {
tied(%hash)->abort();
}
}
for(my $i = 0; $i < 4; $i++) {
if($i % 2) {
$hash{$i} == $i * 10 || die;
} else {
defined($hash{$i}) && die;
}
}
print "Exiting";