Jerome Quelin > App-CPAN2Pkg-3.004 > App::CPAN2Pkg::Lock

Download:
App-CPAN2Pkg-3.004.tar.gz

Dependencies

Annotate this POD

Website

CPAN RT

Open  0
View/Report Bugs
Module Version: 3.004   Source  

NAME ^

App::CPAN2Pkg::Lock - Simple locking mechanism within cpan2pkg

VERSION ^

version 3.004

SYNOPSIS ^

    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;

DESCRIPTION ^

This class implements a simple locking mechanism.

ATTRIBUTES ^

owner

The lock owner (a string).

METHODS ^

is_available

    $lock->is_available;

Return true if one can get control on $lock.

get

    $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.

release

    $lock->release;

Release $lock. It's now available for locking again.

AUTHOR ^

Jerome Quelin <jquelin@gmail.com>

COPYRIGHT AND LICENSE ^

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.

syntax highlighting: