Async-Simple-Pool
view release on metacpan or search on metacpan
lib/Async/Simple/Task/ForkTmpFile.pm view on Meta::CPAN
timeout => timeout in seconds between child checkings for new data passed. default 0.01
kill_on_exit => kill (1) or not (0) subprocess on object destroy (1 by default).
=head2 C<put>
Puts data to task.
$self->put( $data );
=head2 C<get>
Tries to read result from task.
Returns undef if it is not ready.
In case, your function can return undef, you shoud check $task->has_answer, as a mark of ready result.
my $result = $self->get();
=head1 SUPPORT AND DOCUMENTATION
After installing, you can find documentation for this module with the perldoc command.
perldoc Async::Simple::Task::ForkTmpFile
You can also look for information at:
RT, CPAN's request tracker (report bugs here)
http://rt.cpan.org/NoAuth/Bugs.html?Dist=Async-Simple-Task-ForkTmpFile
AnnoCPAN, Annotated CPAN documentation
http://annocpan.org/dist/Async-Simple-Task-ForkTmpFile
CPAN Ratings
http://cpanratings.perl.org/d/Async-Simple-Task-ForkTmpFile
Search CPAN
http://search.cpan.org/dist/Async-Simple-Task-ForkTmpFile/
=head1 AUTHOR
ANTONC <antonc@cpan.org>
=head1 LICENSE
This program is free software; you can redistribute it and/or modify it
under the terms of the the Artistic License (2.0). You may obtain a
copy of the full license at:
L<http://www.perlfoundation.org/artistic_license_2_0>
=cut
use Modern::Perl;
use Moose;
use namespace::autoclean;
use Data::Serializer;
use Time::HiRes qw/ alarm sleep /;
use File::Spec;
our $VERSION = '0.18';
extends 'Async::Simple::Task::Fork';
=head1 Attributes
=head2 task
task = sub {
my ( $data ) = @_; # source data for task
... your task code ...
return( $result );
}
=cut
=head2 answer
Result of current task
=cut
=head2 has_answer
has_answer is true, if the task has been finished and result has been ready
=cut
=head2 timeout
timeout - positive numeric value = seconds between checking for result.
inherited from Async::Simple::Task.
=cut
=head2 kill_on_exit
Kills process from parent in case of object desctuction
=cut
=head2 new()
my $task = Async::Simple::Task::ForkTmpFile->new( %all_optional_params );
Possible keys for %all_optional_params:
task => coderef, function, called for each "data" passed to child process via $task->put( $data );
( run in 0.912 second using v1.01-cache-2.11-cpan-39bf76dae61 )