Forks::Queue::File - file-based implementation of Forks::Queue
0.03
my $q = Forks::Queue::File->new( file => "queue-file" ); $q->put( "job1" ); $q->put( { name => "job2", task => "do something", data => [42,19] } ); ... $q->end; for my $w (1 .. $num_workers) { if (fork() == 0) { my $task; while (defined($task = $q->get)) { ... perform task in child ... } exit; } }
See Forks::Queue for an overview of the methods supported by this Forks::Queue implementation.
Forks::Queue
The Forks::Queue::File constructor recognized the following configuration options.
Forks::Queue::File
file
The name of the file to use to score queue data and metadata. If omitted, a temporary filename is chosen.
It is strongly recommended not to use a file that would reside on an NFS filesystem, since these filesystems have notorious difficulty with synchronizing files across processes.
style
limit
on_limit
join
persist
See Forks::Queue for descriptions of these options.
As with anything that requires flock, you should avoid allowing the queue file to reside on an NFS drive.
flock
Copyright (c) 2017, Marty O'Brien.
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.10.1 or, at your option, any later version of Perl 5 you may have available.
See http://dev.perl.org/licenses/ for more information.
To install Forks::Queue, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Forks::Queue
CPAN shell
perl -MCPAN -e shell install Forks::Queue
For more information on module installation, please visit the detailed CPAN module installation guide.