<html><head><meta name="color-scheme" content="light dark"></head><body><pre style="word-wrap: break-word; white-space: pre-wrap;">#!/usr/bin/perl -w
use IO::Socket;
use DBI;

my $identifier = 'isonaslogger';
my $password = 'apassword';
my $isonasServer = '10.9.1.100';

my $char = "";
my $hell = "hot";
my $frozen = "lame";
my $line = "";

# Greets

print "ISONAS Door Control Logger\n";
print "Build: 1.00.043 Andy Dixon - andy\@unified.cc\n\n";

my $sock = new IO::Socket::INET (
                                PeerAddr =&gt; $isonasServer,
                                PeerPort =&gt; '5321',
                                Proto =&gt; 'tcp',
                                );
die "Could not create socket: $!\n" unless $sock;

print "Sending Authentication String..";
print $sock "&lt;LOGON&gt;&lt;$identifier&gt;&lt;$password&gt;|";
print " Done\n";

until ($hell eq $frozen)
{
  sysread($sock, $char,1);
  $line = $line . $char;
  if ($char =~ m/\|$/) {
        if ($line =~ m/LOGON/) {
                        # Discard if retval is a login thing
                        $line = "";
                } else {
                        # check for (cr|lf)+pipe
                        chomp($line);
                        if ($line =~ m/\&gt;\|$/) {
                                # Convert pointies to quotes 'n' commas
                                $line =~ s/\&gt;\&lt;/\'\,\'/g;
                                $line =~ s/\&lt;/\'/g;
                                $line =~ s/\&gt;/\'/g;

                                # Trim whitespace
                                $line =~ s/\ \'/\'/g;
                                $line =~ s/\'\ /\'/g;
                                $line =~ s/\ \'/\'/g;
                                $line =~ s/\'\ /\'/g;
                                $line =~ s/\ \'/\'/g;
                                $line =~ s/\'\ /\'/g;
                                $line =~ s/\ \'/\'/g;
                                $line =~ s/\'\ /\'/g;
                                # Remove Pipe
                                $line =~ s/\|//g;

                                print $line."\n";

                                $line="";
                        }else {
                        #discard (cr|lf)+pipe
                        $line="";
                        }
                }
        }
}

close($sock);
</pre></body></html>