403Webshell
Server IP : 104.21.13.164  /  Your IP : 216.73.216.72
Web Server : Apache
System : Linux gator4057.hostgator.com 5.14.0-687.17.1.el9_8.x86_64 #1 SMP PREEMPT_DYNAMIC Mon Jun 22 07:21:26 EDT 2026 x86_64
User : badawi ( 1130)
PHP Version : 8.3.31
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : OFF  |  Sudo : ON  |  Pkexec : ON
Directory :  /usr/share/doc/perl-Parallel-ForkManager/examples/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /usr/share/doc/perl-Parallel-ForkManager/examples/callback_data.pl
use strict;
use warnings;

use Parallel::ForkManager;

my $max_procs = 2;
my @names = qw( Fred Jim );

my $pm = Parallel::ForkManager->new($max_procs, @ARGV);

# Setup a callback for when a child finishes up so we can
# get it's exit code and any data it collected
$pm->run_on_finish( sub {
  my ($pid, $exit_code, $ident, $exit_signal, $core_dump, $data_structure_reference) = @_;
  print "$ident just got out of the pool ".
    "with exit code: $exit_code and data: @$data_structure_reference\n";
});

$pm->run_on_start( sub {
  my ($pid,$ident)=@_;
  print "$ident started\n";
});

foreach my $child ( 0 .. $#names ) {
  my $pid = $pm->start($names[$child]) and next;

  # This code is the child process
  # We can do here anything and obtain any data.
  # The result can be any array or hash.
  my @result = ($names[$child], length $names[$child]);
  sleep 1+rand(3);

  # pass an exit code and data stucture to finish
  $pm->finish($child, \@result );
}

#print "Waiting for Children...\n";
$pm->wait_all_children;
print "Everybody is out of the pool!\n";



Youez - 2016 - github.com/yon3zu
LinuXploit