summaryrefslogtreecommitdiff
path: root/regress/base/io_map.pl
blob: 5b788d524435ddd087fa8009095abcfce5ab2041 (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
$map = 'file:/etc/mail/sendmail.cf';

while (1) { &p;}

sub p
{
    use FML::IO::Map;
    my $obj = new FML::IO::Map $map;

    if (defined $obj) {
	$obj->open;

	if ($pos) { $obj->setpos($pos);} 

	$i = 0;
	# XXX $obj->getline returns a mail address.
	while (defined ($_ = $obj->get_rawline)) {
	    print $_;
	    last if $i++ > 3;
	}

	# save the current position in the file handle
	$pos = $obj->getpos;

	if ($obj->eof) { exit 0;}

	$obj->close;
    }
}