summaryrefslogtreecommitdiff
path: root/fml/lib
diff options
context:
space:
mode:
authorfukachan <fukachan>2001-01-28 07:52:24 +0000
committerfukachan <fukachan>2001-01-28 07:52:24 +0000
commit03a19cedcd439693c3b9f5fc6dbe112d098d5400 (patch)
tree05b9bb9f2a2f131929dc7168be6b1525a90a547a /fml/lib
parent5b16c25cde4da5b063cd8ad9b71ea5abe9d88192 (diff)
downloadfml8-03a19cedcd439693c3b9f5fc6dbe112d098d5400.tar.gz
fml8-03a19cedcd439693c3b9f5fc6dbe112d098d5400.tar.bz2
fml8-03a19cedcd439693c3b9f5fc6dbe112d098d5400.zip
roll back test
Diffstat (limited to 'fml/lib')
-rwxr-xr-xfml/lib/IO/t/file_map_getpos.pl47
1 files changed, 47 insertions, 0 deletions
diff --git a/fml/lib/IO/t/file_map_getpos.pl b/fml/lib/IO/t/file_map_getpos.pl
new file mode 100755
index 00000000..8d2f8068
--- /dev/null
+++ b/fml/lib/IO/t/file_map_getpos.pl
@@ -0,0 +1,47 @@
+#-*- perl -*-
+#
+# Copyright (C) 2001 Ken'ichi Fukamachi
+# All rights reserved. This program is free software; you can
+# redistribute it and/or modify it under the same terms as Perl itself.
+#
+# $Id$
+# $FML$
+#
+
+use strict;
+use Carp;
+
+my $file = "/etc/passwd";
+my $map = "file:". $file;
+
+use IO::MapAdapter;
+my $obj = new IO::MapAdapter $map;
+$obj->open || croak("cannot open $map");
+if ($obj->error) { croak( $obj->error );}
+
+my $pobot = 0;
+my $done = 0;
+my $i = 0;
+my $pebot = 0;
+my $x;
+while ($x = $obj->getline) {
+ $i++;
+ print "$i ", $x;
+
+ if ($i == 3) {
+ $pebot = $obj->getpos;
+ print STDERR "*** roll back here\n";
+ }
+
+ my $pos = $obj->getpos;
+ unless ($done) {
+ if ($i == 6) {
+ print STDERR "*** try to roll back ... \n";
+ $obj->setpos( $pebot );
+ $done = 1;
+ }
+ }
+}
+$obj->close;
+
+exit 0;