Proc::Simple::Async - Keyword sugar for Proc::Simple


Proc-Simple-Async documentation Contained in the Proc-Simple-Async distribution.

Index


Code Index:

NAME

Top

Proc::Simple::Async - Keyword sugar for Proc::Simple

SYNOPSIS

Top

  async { some_task() };

  my $proc = async { some_other_task(@_) } 1,2,3,4;

DESCRIPTION

Top

This module lets you fork off code that does not require synchronous execution in a simple way. It's syntactically similar to implementations of the async function found in other modules such as forks, threads, and even Coro. Unfortunately, all those modules assumes you want to build your code around the framework they provide and sometimes you do not want more than a simple way to run code asynchronously. This module is a simple wrapper around Proc::Simple and provides nothing more than a convinient way of forking off a task.

FUNCTIONS

Top

async
  my $proc = async { some_task() };

Is just a more convinient way of doing:

  my $proc = Proc::Simple->new;

  $proc->start (sub { some_task() });

Any additional arguments passed to the function as shown in the synopsis section is passed to the code provided in the first argument.

SEE ALSO

Top

Proc::Simple

BUGS

Top

Most software has bugs. This module probably isn't an exception. If you find a bug please either email me, or add the bug to cpan-RT.

AUTHOR

Top

Anders Nor Berle <berle@cpan.org>

COPYRIGHT AND LICENSE

Top


Proc-Simple-Async documentation Contained in the Proc-Simple-Async distribution.

package Proc::Simple::Async;

use Proc::Simple;

require Exporter;

use strict;
use warnings;

our @ISA = qw/Exporter/;

our $VERSION = 0.03;

our $AUTHORITY = 'cpan:BERLE';

our @EXPORT = qw/async/;

sub async (&;@) {
  my $proc = Proc::Simple->new;

  $proc->start (@_);

  return $proc;
}

1;

__END__