Parallel::WorkUnit::Procedural - Provide procedural paradigm forking with ability to pass back data
version 2.202270
# # 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; 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 { ... };
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!).
WorkUnit
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.
Returns the singleton Parallel::WorkUnit used by this module. This can be used to access attributes such as max_children and use_anyevent.
max_children
use_anyevent
async sub { return 1 } \&callback; # To get back results in "ordered" return mode async sub { return 1 }; @results = waitall;
This executes Parallel::WorkUnit-async()>
Parallel::WorkUnit-
Executes Parallel::WorkUnit-asyncs() }
Executes Parallel::WorkUnit-waitall()>
Executes Parallel::WorkUnit-waitone()>
Executes Parallel::WorkUnit-wait()>
Executes Parallel::WorkUnit-count()>
Executes Parallel::WorkUnit-queue()>
This executes Parallel::WorkUnit-start()>
Joelle Maslak <jmaslak@antelope.net>
This software is copyright (c) 2020 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.
To install Parallel::WorkUnit, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Parallel::WorkUnit
CPAN shell
perl -MCPAN -e shell install Parallel::WorkUnit
For more information on module installation, please visit the detailed CPAN module installation guide.