Thread Programmstatus zyklisch feststellen (3 answers)
Opened by Stevee at 2007-02-05 12:23

pq
 2007-02-05 14:46
#74004 #74004
User since
2003-08-04
12208 Artikel
Admin1
[Homepage]
user image
Code: (dl )
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
use IO::Select;
print "($$) parent\n";
$| = 1;
my $timeout = 1;
if ( my $pid = open my $fh, "-|" ) {
   print "($$) opened $pid\n";
   my $s = IO::Select->new;
   $s->add($fh);
   my $ready;
   while (not(($ready) = $s->can_read($timeout))) {
       print ".";
   }
   print $/;
   chomp, print "($$) got ($_) from child\n" while <$ready>;                                        
}
elsif (defined $pid) {
   sleep 3;
   print "($$) i am the child and i finished my work\n";
exit;
}


wohl bekomm's

edit: else durch elsif aufgetauscht\n\n

<!--EDIT|pq|1170679725-->
Always code as if the guy who ends up maintaining your code will be a violent psychopath who knows where you live. -- Damian Conway in "Perl Best Practices"
lesen: Wiki:Wie frage ich & perlintro Wiki:brian's Leitfaden für jedes Perl-Problem

View full thread Programmstatus zyklisch feststellen