/[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 26 by dpavlin, Wed Apr 1 16:59:09 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                    $meteor_fh = IO::Socket::INET->new( $meteor_server )
22                            || warn "can't connect to meteor $meteor_server: $!"; # FIXME warn => die for production
23                    $meteor_fh = 0; # don't try again
24            }
25    
26          warn ">> meteor ",dump( @a );          warn ">> meteor ",dump( @a );
27          print $meteor "ADDMESSAGE test ",join('|',@a),"\n";          print $meteor_fh "ADDMESSAGE test ",join('|',@a),"\n" if $meteor_fh;
28  }  }
29    
30  my $debug = 0;  my $debug = 0;
# Line 52  GetOptions( Line 56  GetOptions(
56          'parity=s'    => \$parity,          'parity=s'    => \$parity,
57          'stopbits=i'  => \$stopbits,          'stopbits=i'  => \$stopbits,
58          'handshake=s' => \$handshake,          'handshake=s' => \$handshake,
59            'meteor=s'    => \$meteor_server,
60  ) or die $!;  ) or die $!;
61    
62  my $verbose = $debug > 0 ? $debug-- : 0;  my $verbose = $debug > 0 ? $debug-- : 0;

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

  ViewVC Help
Powered by ViewVC 1.1.26