The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

IPC::Concurrency::DBI::Application::Instance - Application instance that represents consumption of the limited resource.

VERSION

Version 1.0.3

SYNOPSIS

This module represents one instance of an application managed by IPC::Concurrency::DBI.

See the documentation of IPC::Concurrency::DBI for more information.

        my $instance = $concurrent_program->start_instance();
        unless ( defined( $instance ) )
        {
                print "Too many instances of $0 are already running.\n";
                exit;
        }
        
        # [...] Do some work.
        
        # Now that the application is about to exit, flag the instance as completed.
        # (note: this is implicit when $instance is destroyed).
        $instance->finish();

METHODS

new()

Create a new IPC::Concurrency::DBI::Application::Instance object.

This function should not be called directly and its API could change, instead use IPC::Concurrency::DBI::Application::start_instance().

        # Retrieve the application by name.
        my $instance = IPC::Concurrency::DBI::Application::Instance->new(
                application => $application,
        );

'application': mandatory, an IPC::Concurrency::DBI::Application object.

finish()

Declare that the current instance has finished running and free the slot for a new instance.

INTERNAL METHODS

_get_database_handle()

Returns the database handle used for this queue.

        my $database_handle = $concurrency_manager->_get_database_handle();

_get_application()

Returns the parent IPC::Concurrency::DBI::Application object.

        my $application = $instance->_get_application();

DESTROY()

Automatically clear the slot used by the current instance when the object is destroyed, if finish() has not been called already.

AUTHOR

Guillaume Aubert, <aubertg at cpan.org>.

BUGS

Please report any bugs or feature requests to bug-ipc-concurrency-dbi at rt.cpan.org, or through the web interface at http://rt.cpan.org/NoAuth/ReportBug.html?Queue=IPC-Concurrency-DBI. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.

SUPPORT

You can find documentation for this module with the perldoc command.

        perldoc IPC::Concurrency::DBI

You can also look for information at:

ACKNOWLEDGEMENTS

Thanks to ThinkGeek (http://www.thinkgeek.com/) and its corporate overlords at Geeknet (http://www.geek.net/), for footing the bill while I eat pizza and write code for them!

Thanks to Jacob Rose <jacob at thinkgeek.com> for suggesting the idea of this module and brainstorming with me about the features it should offer.

COPYRIGHT & LICENSE

Copyright 2011-2012 Guillaume Aubert.

This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License version 3 as published by the Free Software Foundation.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program. If not, see http://www.gnu.org/licenses/