NAME
Parallel::SubArray - Forked sub execution with return values and timeouts.
SYNOPSIS
use Parallel::SubArray 'par';
my $sub_arrayref = [
sub{ sleep(1); [1] },
sub{ while(1){} },
sub{ [ 1, {2=>3} ] },
];
my $result_arrayref = par(3)->($sub_arrayref);
$result_arrayref == [
[ 1 ],
undef,
[ 1, { 2 => 3 } ]
];
DESCRIPTION
I want fast, safe, and simple parallelism. Current offerings did not satisfy me. Most are not enough while remaining are too complex or tedious. Palallel::SubArray scratches my itch: forking, joining, timeouts, and return values done simply.
EXPORT
Nothing. I don't like magic.
SEE ALSO
perlipc "fork" in perlfunc perlfork subs::parallel Parallel::Simple Parallel::Queue Parallel::Forker Parallel::Jobs Parallel::Workers Parallel::SubFork Parallel::Pvm Parallel::Performing Parallel::Fork::BossWorker Parallel::ForkControl
BUGS
Do not use Windows and don't even think of using Object Orientfuscation! First part of the statement is justified by the lack of forking on that platform while second cannot exist in the parallel world of tomorrow as it requires locking and that defeats the whole purpose. If you have the itch to ignore the first warning, you will get slower performance (because Perl emulates forking on Windows) and hopefully no bugs. If you have the OO stones, let me know how you have solved the parallelism problem. There are millions that will be happy to pay you millions for the answer.
The joining mechanism of this module can be incompatible with other forking because it's waiting for child processes to finish. Nesting of par
works as expected.
Subroutines passed to par
that return anything other than references to simple Perl structures may behave unexpectedly.
AUTHOR
Eugene Grigoriev, intercalate "@" ["eugene.grigoriev", "gmail.com"]
LICENSE
Copyright (c) 2009, Eugene Grigoriev All rights reserved.
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. Neither the name of copyright holder nor the names of contributors may be used to endorse or promote products derived from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.