package IndexData::Utils::PersistentCounter;

use 5.018002;
use strict;
use warnings;

use IO::File;


sub new {
    my $class = shift();
    my($file, $create) = @_;

    if (! -f $file) {
	return undef if !$create;
	#   ###	There is a bit of a race condition here, but it's not
	#	something that's going to crop up in real life.
	my $fh = new IO::File(">$file") || return undef;
	$fh->print("1\n");
	$fh->close() or return undef;
    }

    my $this = bless {
	file => $file,
    }, $class;

    return $this;
}


sub next {
    my $this = shift();
}


sub delete {
    my $this = shift();
}


1;
