Skip Menu |

This queue is for tickets about the File-Pid CPAN distribution.

Report information
The Basics
Id: 62666
Status: new
Priority: 0/
Queue: File-Pid

People
Owner: Nobody in particular
Requestors: JEB [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: Wishlist
Broken in: 1.01
Fixed in: (no value)



Subject: Doco bug?
I think there is a race condition in the documented use of this module. As currently stated: use File::Pid; my $pidfile = File::Pid->new({ file => '/some/file.pid', }); $pidfile->write; if ( my $num = $pidfile->running ) { die "Already running: $num\n"; } Thsi seems to always tell me it is always already running - as the PID returned from running is the current script's PID. However, if I put the write() call after the running() call, then it successfully catches multiple instances of the same job firing up, as the running() call catches PREVIOUS instances of the same script running: use File::Pid; my $pidfile = File::Pid->new({ file => '/some/file.pid', }); if ( my $num = $pidfile->running ) { die "Already running: $num\n"; } $pidfile->write;