use SIP2::dump_message
authorDobrica Pavlinusic <dpavlin@rot13.org>
Mon, 14 Dec 2009 23:36:20 +0000 (00:36 +0100)
committerDobrica Pavlinusic <dpavlin@rot13.org>
Mon, 14 Dec 2009 23:36:20 +0000 (00:36 +0100)
sc-emulator.pl

index 715c014..65b140e 100755 (executable)
@@ -5,25 +5,27 @@ use strict;
 
 use IO::Socket::INET;
 use autodie;
 
 use IO::Socket::INET;
 use autodie;
-use Data::Dump qw(dump);
 
 our $user     = 'sip2-user';
 our $password = 'sip2-paasswd';
 
 require 'config.pl' if -e 'config.pl';
 
 
 our $user     = 'sip2-user';
 our $password = 'sip2-paasswd';
 
 require 'config.pl' if -e 'config.pl';
 
+use SIP2;
+
 our $sock = IO::Socket::INET->new( '10.60.0.251:6001' );
 
 our $sock = IO::Socket::INET->new( '10.60.0.251:6001' );
 
+
 sub sip2 {
        my ( $send, $patt ) = @_;
 sub sip2 {
        my ( $send, $patt ) = @_;
-       warn ">>>> ", dump($send), "\n";
+       SIP2::dump_message '>>>>', $send;
        print $sock "$send\r\n";
        $sock->flush;
 
 #      local $/ = "\r";
 
        my $in = <$sock>;
        print $sock "$send\r\n";
        $sock->flush;
 
 #      local $/ = "\r";
 
        my $in = <$sock>;
-       warn "<<<< ", dump($in), "\n";
+       SIP2::dump_message '<<<<', $in;
        die "expected $patt" unless $in =~ $patt;
 }
 
        die "expected $patt" unless $in =~ $patt;
 }
 
@@ -37,4 +39,5 @@ sip2 "9900302.00" => qr/^98/;
 sip2 "09N20091214    08142820091214    081428AP|AOFFZG|AB1301036581|AC|BIN|" => qr/^10/;
 
 # Patron Information
 sip2 "09N20091214    08142820091214    081428AP|AOFFZG|AB1301036581|AC|BIN|" => qr/^10/;
 
 # Patron Information
-sip2 "6300020091214    085452          AOFFZG|AA200903260093|AC$password|" => qr/^54/;
+sip2 "6300020091214    085452          AOFFZG|AA200903260093|AC$password|" => qr/^64/;
+