/[RFID]/3m-810.pl
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Diff of /3m-810.pl

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 25 by dpavlin, Sun Mar 29 01:05:49 2009 UTC revision 27 by dpavlin, Mon Apr 6 11:21:15 2009 UTC
# Line 11  use Getopt::Long; Line 11  use Getopt::Long;
11  use IO::Socket::INET;  use IO::Socket::INET;
12    
13  my $meteor_server = '192.168.1.13:4671';  my $meteor_server = '192.168.1.13:4671';
14    my $meteor_fh;
 my $meteor = IO::Socket::INET->new( $meteor_server )  
          || die "can't connect to meteor $meteor_server: $!";  
15    
16  sub meteor {  sub meteor {
17          my @a = @_;          my @a = @_;
18          push @a, scalar localtime() if $a[0] =~ m{^info};          push @a, scalar localtime() if $a[0] =~ m{^info};
19    
20            if ( ! defined $meteor_fh ) {
21                    warn "# open connection to $meteor_server";
22                    $meteor_fh = IO::Socket::INET->new(
23                                    PeerAddr => $meteor_server,
24                                    Timeout => 1,
25                    ) || warn "can't connect to meteor $meteor_server: $!"; # FIXME warn => die for production
26                    $meteor_fh = 0; # don't try again
27            }
28    
29          warn ">> meteor ",dump( @a );          warn ">> meteor ",dump( @a );
30          print $meteor "ADDMESSAGE test ",join('|',@a),"\n";          print $meteor_fh "ADDMESSAGE test ",join('|',@a),"\n" if $meteor_fh;
31  }  }
32    
33  my $debug = 0;  my $debug = 0;
# Line 52  GetOptions( Line 59  GetOptions(
59          'parity=s'    => \$parity,          'parity=s'    => \$parity,
60          'stopbits=i'  => \$stopbits,          'stopbits=i'  => \$stopbits,
61          'handshake=s' => \$handshake,          'handshake=s' => \$handshake,
62            'meteor=s'    => \$meteor_server,
63  ) or die $!;  ) or die $!;
64    
65  my $verbose = $debug > 0 ? $debug-- : 0;  my $verbose = $debug > 0 ? $debug-- : 0;

Legend:
Removed from v.25  
changed lines
  Added in v.27

  ViewVC Help
Powered by ViewVC 1.1.26