Author image Ashish Gulhati
and 1 contributors

NAME

IPC::Queue::Duplex - Filesystem based request / response queue

VERSION

 $Revision: 1.009 $
 $Date: Tue Oct 16 21:48:32 PDT 2018 $

SYNOPSIS

    (Enqueuer)

    use IPC::Queue::Duplex;

    my $client = new IPC::Queue::Duplex (Dir => $dir);
    my $job = $client->add($jobstr);
    my $response = $job->response;

    (Worker)

    use IPC::Queue::Duplex;

    my $server = new IPC::Queue::Duplex (Dir => $dir);
    my $job = $server->get:
    process_job($job);
    $job->finish($result);

METHODS

new

Creates and returns a new IPC::Queue::Duplex object. Requires one named parameter:

    Dir - The directory that will contain the queue for this object. It's important to use a unique directory per queue,

add

Adds a job to the queue and returns an IPC::Queue::Duplex::Job object. A single aregument is required, the job request as a string.

get

Gets a job from the queue and returns an IPC::Queue::Duplex::Job object. Returns undef if there is no job waiting.

addfile

Adds a job to the queue, with an explicitly provided filename, and returns an IPC::Queue::Duplex::Job object. Two arguments are required: the filename to use for the job, and the job request string, in that order.

getresponse

Get a response from the queue. Normally a requester would hold on to their job object and get the response by calling the response method on that object. However, a requester can can also handle responses asynchronously and call this method to get the next waiting response instead. Returns an IPC::Queue::Duplex::Job object, or undef if there is no response on the queue.

AUTHOR

Ashish Gulhati, <ipc-qd at hash.neo.tc>

BUGS

Please report any bugs or feature requests to bug-ipc-queue-duplex at rt.cpan.org, or through the web interface at http://rt.cpan.org/NoAuth/ReportBug.html?Queue=IPC-Queue-Duplex. 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::Queue::Duplex

You can also look for information at:

LICENSE AND COPYRIGHT

Copyright (c) Ashish Gulhati.

This software package is Open Software; you can use, redistribute, and/or modify it under the terms of the Open Artistic License 2.0.

Please see http://www.opensoftwr.org/oal20.txt for the full license terms, and ensure that the license grant applies to you before using or modifying this software. By using or modifying this software, you indicate your agreement with the license terms.