Thread parallele filehandles (24 answers)
Opened by Gast at 2006-08-28 12:57

esskar
 2006-08-29 10:35
#69296 #69296
User since
2003-08-04
7321 Artikel
ModeratorIn

user image
check es mal
Code: (dl )
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#!/usr/bin/perl -w

$| ||= 1;

use strict;

my $MaxProcessCount = 5;

for (1 .. $MaxProcessCount) {
my $pid = fork;

die "Unable to fork!" unless defined $pid;

if($pid == 0) {
SubFunction('localhost');
exit 0;
}
}

sub SubFunction {
my ($host) = @_;
print "- process: $$\n";

my $fh;
open($fh, '-|', "ping.exe $host") or die "couldn't open pipe!";
print while (<$fh>);
close($fh);
}

View full thread parallele filehandles