Acme-Ghost
view release on metacpan or search on metacpan
lib/Acme/Ghost/FilePid.pm view on Meta::CPAN
package Acme::Ghost::FilePid;
use strict;
use utf8;
=encoding utf-8
=head1 NAME
Acme::Ghost::FilePid - The Pid File simple interface
=head1 SYNOPSIS
use Acme::Ghost::FilePid;
my $fp = Acme::Ghost::FilePid->new (
file => '/some/file.pid',
);
if ( my $num = $fp->running ) {
die "Already running: $num";
} else {
$fp->save;
# . . .
$fp->remove;
}
... or with autoremove:
my $fp = Acme::Ghost::FilePid->new (
file => '/some/file.pid',
autoremove => 1,
);
die "Already running" if $fp->running;
$fp->save;
# . . .
... or with autosave and autoremove
my $fp = Acme::Ghost::FilePid->new (
file => '/some/file.pid',
auto => 1,
);
die "Already running" if $fp->running;
# . . .
=head1 DESCRIPTION
This software manages a pid file for you. It will create a pid file,
query the process within to discover if it's still running, and remove
the pid file.
=head2 new
my $fp = Acme::Ghost::FilePid->new;
my $fp = Acme::Ghost::FilePid->new(
file => '/var/run/daemon.pid',
);
my $fp = Acme::Ghost::FilePid->new(
file => '/var/run/daemon.pid',
pid => '145',
autoremove => 1,
);
( run in 1.503 second using v1.01-cache-2.11-cpan-99c4e6809bf )