5d0500dc7a
- 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)
42 lines
612 B
Perl
Executable file
42 lines
612 B
Perl
Executable file
#!/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;
|
|
}
|
|
|
|
Stasis::Tinit();
|
|
|
|
my %hash;
|
|
|
|
tie %hash, 'Stasis::Hash';
|
|
|
|
for(my $i = 0; $i < 4; $i++) {
|
|
$hash{$i} = $i * 10;
|
|
if($i % 2) {
|
|
tied(%hash)->commit();
|
|
} else {
|
|
tied(%hash)->abort();
|
|
}
|
|
}
|
|
Stasis::Tdeinit();
|
|
Stasis::Tinit();
|
|
|
|
tie %hash, 'Stasis::Hash';
|
|
|
|
for(my $i = 0; $i < 4; $i++) {
|
|
if($i % 2) {
|
|
$hash{$i} == $i * 10 || die;
|
|
} else {
|
|
defined($hash{$i}) && die;
|
|
}
|
|
}
|
|
|
|
Stasis::Tdeinit();
|
|
|
|
print "Passed";
|