Softpedia
 


LINUX CATEGORIES:



GLOBAL PAGES >>
NEWS ARCHIVE >>
SOFTPEDIA REVIEWS >>
MEET THE EDITORS >>
WEEK'S BEST
  • Linux Kernel 3.9.3 / 3....
  • LibreOffice 3.6.6 / 4.0.3
  • MPlayer 1.1.1
  • systemd 204
  • Arch Linux 2013.05.01
  • Blender 2.67
  • KDE Software Compilatio...
  • CrunchBang Linux Stable...
  • Elementary OS 0.1 / 0.2...
  • SystemRescueCd 3.6.0
  • Home > Linux > Programming > Perl Modules

    XML::Comma::Pkg::MySQL_Simple_Lock 1.998

    Download button

    No screenshots available
    Downloads: 445  View global page NEW!  Tell us about an update
    User Rating:
    Rated by:
    Good (3.1/5)
    19 user(s)
    Developer:

    License / Price:

    Last Updated:

    Category:
    Brian Szymanski | More programs
    Perl Artistic License / FREE
    June 9th, 2008, 15:21 GMT
    ROOT / Programming / Perl Modules

     Read user reviews (0)  Refer to a friend  Subscribe

    XML::Comma::Pkg::MySQL_Simple_Lock description

    A simple one-time-use lock coordinated by db.

    XML::Comma::Pkg::MySQL_Simple_Lock is a simple one-time-use lock coordinated by db.

    SYNOPSIS

    use XML::Comma::Pkg::MySQL_Simple_Lock;

    my $lock = XML::Comma::Pkg::MySQL_Simple_Lock->new ( "foo", 10 );
    die "couldn't get lockn" unless $lock;
    undef $lock

    Comma applications can be spread across multiple machines in a cluster, as long as core database operations are all pointed at a centralized server. This module provides advisory locking capabilities to Comma programmers working in such an environment.

    MySQL exposes a very simple advisory locking API, the functions GET_LOCK() and RELEASE_LOCK(). This module provides a very simple, object-oriented abstraction on top of these functions. Here is a simple test script:

    #!/usr/bin/perl -w

    use strict; $|++;
    use XML::Comma::Pkg::MySQL_Simple_Lock;

    &do_lock;
    print "waiting outside scope... "; my $junk = ;

    sub do_lock {
    my $lock = XML::Comma::Pkg::MySQL_Simple_Lock->new ( "foo", 1 );
    die "couldn't get lockn" unless $lock;

    print "$lockn";
    print "waiting inside scope... "; my $junk = ;
    }

    The new() method expects a key_string argument, which is used to "name" the lock, and an optional timeout argument. timeout should be given in seconds, and defaults to 86400, or one day.

    new() returns a lock object on success, or undef on failure.

    The lock is held as long as a reference to the MySQL_Simple_Lock object is being held. When all references to the object go out of scope, the object is destroyed and the lock is automatically released. It is a good idea to explicitly undef any lock objects, to make life easier for maintenance programmers.

    Each MySQL_Simple_Lock object is a one-time-use construct. To request a new lock, make a new object.

    Each MySQL_Simple_Lock object occupies a database connection as long as it is held.


    Product's homepage

    Requirements:

    · Perl

      


    TAGS:

    MySQL lock | database lock | Perl module | MySQL | database | lock

    Go to top

    WindowsGamesDriversMacLinuxScriptsMobileHandheldNews

    SUBMIT PROGRAM   |   ADVERTISE   |   GET HELP   |   SEND US FEEDBACK   |   RSS FEEDS   |   UPDATE YOUR SOFTWARE   |   ROMANIAN FORUM