NAME
Script::Singleton - Ensure only a single instance of a script can run
SYNOPSIS
use Script::Singleton; # Yep, that's it!
DESCRIPTION
Using shared memory, this distribution ensures only a single instance of any script can be running at any one time.
There are no functions or methods. All the work is performed in the use line.
This software uses IPC::Shareable for the shared memory management, specifically its singleton() method.
EXAMPLES
Basic
use Script::Singleton;
Using it in the default, basic fashion, we'll create an IPC identifier (glue) using the full path and name of the calling script. We also won't output any warnings if a second instance of the script attempts to run before the initial run has completed and released the lock.
Custom glue
use Script::Singleton glue => 'UNIQUE GLUE STRING';
That will use UNIQUE GLUE STRING as the IPC glue. The glue parameter can be used in conjunction with the warn parameter.
Warnings
use Script::Singleton warn => 1;
If the warn
parameter is sent in with a true value, we'll emit a warning if a second instance of the script is run. The warn parameter can be used in conjunction with the glue parameter.
AUTHOR
Steve Bertrand, <steveb at cpan.org>
LICENSE AND COPYRIGHT
Copyright 2021 Steve Bertrand.
This program is free software; you can redistribute it and/or modify it under the terms of the the Artistic License (2.0). You may obtain a copy of the full license at: