summaryrefslogtreecommitdiff
path: root/regress/base/journaledfile.pl
blob: 3b4797fa135e45b76cfbcf2fd150a49b5f5ab15d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#!/usr/bin/env perl
#
# $FML: journaledfile.pl,v 1.1 2001/08/05 13:07:59 fukachan Exp $
#

use strict;
use lib qw(../../fml/lib);
use Tie::JournaledFile;

my %db   = ();
my $file = '/tmp/fml5/cache.txt';
my $buf  = '';
my $key  = "rudo$$";
chop($buf = `date`);

tie %db, 'Tie::JournaledFile', { file => $file };
$db{ $key } = $buf;
untie %db;

print "   ", `ls -l $file`;

tie %db, 'Tie::JournaledFile', { file => $file };

print "verify written string ... ";
if ($db{ $key } eq $buf) {
    print "ok\n";
} 
else {
    print "fail\n";
    print "   >", $db{ $key }, "<\n";
    print "   >", $buf, "<\n";
}

exit 0;