X-Git-Url: http://git.rot13.org/?a=blobdiff_plain;f=sc-emulator.pl;h=34886124e17442f888be2b66713cd24b4fecbb78;hb=7108951ead6fcb1d3719c4ea7c79cfffc520ed02;hp=715c014094c1a4eaac72f4fe175f50f2bf65d4ba;hpb=e46b1e36be872896991f47226349f81b5839763a;p=Biblio-SIP2.git diff --git a/sc-emulator.pl b/sc-emulator.pl index 715c014..3488612 100755 --- a/sc-emulator.pl +++ b/sc-emulator.pl @@ -5,36 +5,38 @@ use strict; use IO::Socket::INET; use autodie; -use Data::Dump qw(dump); our $user = 'sip2-user'; our $password = 'sip2-paasswd'; +our $patron = 200000000042; +our $barcode = 1301132799; +our $loc = 'FFZG'; require 'config.pl' if -e 'config.pl'; -our $sock = IO::Socket::INET->new( '10.60.0.251:6001' ); +use SIP2; -sub sip2 { - my ( $send, $patt ) = @_; - warn ">>>> ", dump($send), "\n"; - print $sock "$send\r\n"; - $sock->flush; - -# local $/ = "\r"; - - my $in = <$sock>; - warn "<<<< ", dump($in), "\n"; - die "expected $patt" unless $in =~ $patt; -} +SIP2::connect '10.60.0.251:6001'; # login -sip2 "9300CN$user|CO$password|" => qr/^941/; +SIP2::send "9300CN$user|CO$password|"; # SC Status -sip2 "9900302.00" => qr/^98/; +SIP2::send "9900302.00"; + +# Patron Information +SIP2::send "6300020091214 085452 AO$loc|AA$patron|AC$password|"; + +# Checkout +SIP2::send "11YN20091214 124436 AO$loc|AA$patron|AB$barcode|AC$password|BON|BIN|"; # Checkin -sip2 "09N20091214 08142820091214 081428AP|AOFFZG|AB1301036581|AC|BIN|" => qr/^10/; +SIP2::send "09N20091214 08142820091214 081428AP|AO$loc|AB$barcode|AC|BIN|"; + + +# checkout another +SIP2::send "09N20091216 15320820091216 153208AP|AOFFZG|AB200903160190|ACviva2koha|BIN|"; + +# status +SIP2::send "9900302.00"; -# Patron Information -sip2 "6300020091214 085452 AOFFZG|AA200903260093|AC$password|" => qr/^54/;