NAME
Parallel::WorkUnit::Procedural - Provide procedural paradigm forking with ability to pass back data
VERSION
version 2.243450
SYNOPSIS
#
# Procedural Interface
#
use Parallel::WorkUnit::Procedural qw(:all); # Export all symbols
async sub { ... }, \&callback;
waitall;
#
# Limiting Maximum Parallelization
#
WorkUnit->max_children(5);
queue sub { ... }, \&callback;
queueall \@data, sub { ... }, \&callback;
waitall;
#
# Ordered Responses
#
async sub { ... };
@results = waitall;
#
# Spawning off X number of workers
# (Ordered Response paradigm shown with 10 children)
#
asyncs( 10, sub { ... } );
@results = waitall;
#
# AnyEvent Interface
#
use AnyEvent;
WorkUnit->use_anyevent(1);
async sub { ... }, \&callback;
waitall; # Not strictly necessary
#
# Just spawn something into another process, don't capture return
# values, don't allow waiting on process, etc.
#
start { ... };
DESCRIPTION
This provides a simple procedural instance to Parallel::WorkUnit where it is not important to modify attributes of the global Parallel::WorkUnit singleton used by this module.
While the underlying singleton is exposed (via the WorkUnit
subroutine), it is highly recommended that users not use this directly, as unexpected interactions may occur (it is a global singleton, after all!).
Please read the documentation on Parallel::WorkUnit for detailed information about this module.
This module was added to the Parallel-WorkUnit distribution in 1.191810.
FUNCTIONS
WorkUnit
Returns the singleton Parallel::WorkUnit used by this module. This can be used to access attributes such as max_children
and use_anyevent
.
async { ... }, \&callback
async sub { return 1 } \&callback;
# To get back results in "ordered" return mode
async sub { return 1 };
@results = waitall;
This executes Parallel::WorkUnit-
async()>
asyncs( $children, sub { ... }, \&callback )
Executes Parallel::WorkUnit-
asyncs() }
waitall
Executes Parallel::WorkUnit-
waitall()>
waitone
Executes Parallel::WorkUnit-
waitone()>
proc_wait($pid)
Executes Parallel::WorkUnit-
wait()>
proc_count()
Executes Parallel::WorkUnit-
count()>
queue sub { ... }, \&callback
Executes Parallel::WorkUnit-
queue()>
queueall $data, sub { ... }, \&callback
Added in 2.243450.
Executes Parallel::WorkUnit-
queueall()>
start { ... };
This executes Parallel::WorkUnit-
start()>
AUTHOR
Joelle Maslak <jmaslak@antelope.net>
COPYRIGHT AND LICENSE
This software is copyright (c) 2015-2023 by Joelle Maslak.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.