Thread windows und alarm() bzw select... (8 answers)
Opened by the-loader at 2007-07-17 14:16

sid burn
 2007-07-17 14:41
#78542 #78542
User since
2006-03-29
1520 Artikel
BenutzerIn

user image
Unter Umständen geht auch "select".
Läuft jedenfalls unter GNU/Linux bei mir ohne Probleme.

Code (perl): (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
#!/usr/bin/perl
use strict;
use warnings;
use IO::Select;
use IO::Handle;

my $select = IO::Select->new;
$select->add( \*STDIN );

STDIN->blocking(0);
STDOUT->autoflush(1);

print "Bitte etwas eingeben: ";
if ( my @ready = $select->can_read(10) ) {
    for my $fh ( @ready ) {
        while ( my $line = <$fh> ) {
            chomp $line;
            print "Empfangen: $line\n";
        }
    }
}
else {
    print "Timeout\n";
}
Nicht mehr aktiv. Bei Kontakt: ICQ: 404181669 E-Mail: perl@david-raab.de

View full thread windows und alarm() bzw select...