Skip Menu |

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

Report information
The Basics
Id: 5979
Status: resolved
Priority: 0/
Queue: Proc-PID-File

People
Owner: Nobody in particular
Requestors: Dan [...] DWright.Org
Cc:
AdminCc:

Bug Information
Severity: Critical
Broken in: 1.23
Fixed in: (no value)



Subject: running() destroys its own pid file before returning.
The implementation of sub running() creates a Proc::PID::File object named $self in its lexical scope. As soon as running() returns, $self falls out of scope, and its DESTROY method is called. This removes the pid file that was created by running().
Show quoted text
> The implementation of sub running() creates a Proc::PID::File object > named $self in its lexical scope. As soon as running() returns, > $self falls out of scope, and its DESTROY method is called. This > removes the pid file that was created by running().
I'm amazed I never ran into this. The simple solution is to declare $self outside of the function like this: my $self; sub running { $self = shift->new(@_); instead of the current: sub running { my $self = shift->new(@_); that should do it, no?
release 1.24 scraps the OO and procedural interfaces so this bug is no longer relevant. thanks for pointint it out.