--- 3m-810.pl 2009/04/08 15:03:49 34 +++ 3m-810.pl 2009/04/10 12:16:20 35 @@ -19,16 +19,23 @@ push @a, scalar localtime() if $a[0] =~ m{^info}; if ( ! defined $meteor_fh ) { - warn "# open connection to $meteor_server"; - $meteor_fh = IO::Socket::INET->new( - PeerAddr => $meteor_server, - Timeout => 1, - ) || warn "can't connect to meteor $meteor_server: $!"; # FIXME warn => die for production - $meteor_fh = 0; # don't try again + if ( $meteor_fh = + IO::Socket::INET->new( + PeerAddr => $meteor_server, + Timeout => 1, + ) + ) { + warn "# meteor connected to $meteor_server"; + } else { + warn "can't connect to meteor $meteor_server: $!"; + $meteor_fh = 0; + } } - warn ">> meteor ",dump( @a ); - print $meteor_fh "ADDMESSAGE test ",join('|',@a),"\n" if $meteor_fh; + if ( $meteor_fh ) { + warn ">> meteor ",dump( @a ); + print $meteor_fh "ADDMESSAGE test ",join('|',@a),"\n" + } } my $debug = 0;