my $pingok = 0;
$myping =~ s/HOST/$host/g;
- $SIG{'ALRM'} = sub { die };
- alarm(5);
-
- eval <<'_EOM_';
- open( PING, "$myping 2>&1 |") || warn "can't call ping: $!";
- while( <PING> ) {
- $message .= $_;
- if( /bytes from/ ) { $pingok = 1; }
- if( /is alive/ ) { $pingok = 1; }
- }
-_EOM_
- alarm(0);
- close PING;
+ eval {
+ local $SIG{'ALRM'} = sub { die };
+ alarm(5);
+
+ open( PING, "$myping 2>&1 |") || warn "can't call ping: $!";
+ while( <PING> ) {
+ $message .= $_;
+ if( /bytes from/ ) { $pingok = 1; }
+ if( /is alive/ ) { $pingok = 1; }
+ }
+
+ alarm(0);
+ close PING;
+ };
if( ! $pingok ) {
$color = "red";