=head1 NAME

File::Lockfile - create lockfile to prevent process simultaneous run

=head1 SYNOPSIS

	use File::Lockfile;

	my $lockfile = File::Lockfile->new(
		'programname.pid',
		'/var/lock');

	...
		
	if ( my $pid = $lockfile->check ) {
		print "Seems that programname is already running with PID: $pid";
		exit;
	}
	
	$lockfile->write;
	
	...
	
	#somewhere in the end
	Lockfile->remove 
	or
	$lockfile->remove;
	

=head1 DESCRIPTION

C<File::Lockfile> provides convenient interface for creating process pid file.
While text file creating is very simple procedure, module performs additional checks if process is really running.

=head1 METHODS

=head2 new

Initializes module with required arguments.

=head2 check

Checks if lockfile exists, returns PID of running process.
Actually, routine also checks if process with PID stored in lockfile actually running.

my $pid = $lockfile->check;

=head2 write

Writes lockfile. Use it somewhere after checking if file exists

=head2 remove

Removes lockfile. Manage it by yourself. 

=head1 SEE ALSO

L<File::PID> L<File::PID::Quick>

=head1 LICENSE AND COPYRIGHT

Copyright 2008-2010, Sergey Sinkovskiy <glorybox@cpan.org>

This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
