Thread Einfache While-Schleife bis Interverbindung da ist (7 answers)
Opened by kami at 2010-09-04 14:13

esskar
 2010-09-04 20:47
#141172 #141172
User since
2003-08-04
7321 Artikel
ModeratorIn

user image
Code (perl): (dl )
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#!/usr/bin/perl

use warnings;
use strict;

use LWP::Online 'online';
  
my $start = time();
my $now = 0;
my $max = 30;
my $conn = 0;

while ($now < $max) {
    if ( online('http') ) {
        $conn = 1;
        last;
    }
    sleep(1);
    $now = time() - $start;    
}
die "$max seconds over. No connection. Aborting.\n" unless $conn;

View full thread Einfache While-Schleife bis Interverbindung da ist