Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine
 
PerlMonks  

Re: spawning Perl scripts

by phydeauxarff (Priest)
on Mar 28, 2003 at 13:07 UTC ( [id://246458]=note: print w/replies, xml ) Need Help??


in reply to spawning Perl scripts

Just to add another way to do this, I have used Parallel::Forkmanager for several scripts that needed to run forked processes. One feature I really appreciate is the ability to limit the number of processes started.

Here is an example from the DOCs for your convienance.

  use Parallel::ForkManager;

  $pm = new Parallel::ForkManager($MAX_PROCESSES);

  foreach $data (@all_data) {
    # Forks and returns the pid for the child:
    my $pid = $pm->start and next; 

    ... do some work with $data in the child process ...

    $pm->finish; # Terminates the child process
  }

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://246458]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others scrutinizing the Monastery: (2)
As of 2024-04-25 05:39 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found