The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

Script::Singleton - Ensure only a single instance of a script can run

Coverage Status

SYNOPSIS

    use Script::Singleton 'LOCK';

DESCRIPTION

Using shared memory, this distribution ensures only a single instance of any script can be running at any one time.

    use Script::Singleton 'UNIQUE LOCK STRING', 1;

There are no functions or methods. All the work is performed in the use line. UNIQUE LOCK STRING is the glue that identifies the shared memory segment. If a second parameter with a true value is sent in, we'll output a warning if the same script is run at the same time and it exits:

This software uses IPC::Shareable for the shared memory management, specifically its singleton() method.

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:

http://www.perlfoundation.org/artistic_license_2_0