App::CPAN2Pkg::Lock - use Moose;
version 3.001
use App::CPAN2Pkg::Lock; my $lock = App::CPAN2Pkg::Lock->new; $lock->get( 'foo' ); # ... $lock->is_available; # false $lock->owner; # foo $lock->get( 'bar' ); # dies # ... $lock->release;
This class implements a simple locking mechanism.
The lock owner (a string).
$lock->is_available;
Return true if one can get control on $lock.
$lock
$lock->get( $owner );
Try to give the $lock control to $owner. Dies if it's already owned by something else, or if new $owner is not specified.
$owner
$lock->release;
Release $lock. It's now available for locking again.
Jerome Quelin <jquelin@gmail.com>
This software is copyright (c) 2009 by Jerome Quelin.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.
To install App::CPAN2Pkg, copy and paste the appropriate command in to your terminal.
cpanm
cpanm App::CPAN2Pkg
CPAN shell
perl -MCPAN -e shell install App::CPAN2Pkg
For more information on module installation, please visit the detailed CPAN module installation guide.