Nick Kostirya > BGS > BGS::Limit

Download:
BGS-0.04.tar.gz

Dependencies

Annotate this POD

View/Report Bugs
Module Version: 0.04   Source  

NAME ^

BGS::Limit - Background execution of subroutines in child processes with limit of child processes.

SYNOPSIS ^

  use BGS::Limit;

  my @foo;

  foreach my $i (1 .. 7) {
    bgs_call {
      # child process
      return "Start $i";
    } bgs_back {
      # callback subroutine
      my $r = shift;
      push @foo, "End $i. Result: '$r'.\n";
    };
  }

  my $limit = 3;
  bgs_wait($limit);

  print foreach @foo;

ATTENTION ^

Do not use $_ in bgs_call.

SEE ^

 BGS - Background execution of subroutines in child processes.

AUTHOR ^

Nick Kostirya

COPYRIGHT AND LICENSE ^

Copyright (C) 2011 by Nick Kostirya

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.8.8 or, at your option, any later version of Perl 5 you may have available.

syntax highlighting: