X-Git-Url: http://git.rot13.org/?a=blobdiff_plain;f=sc-emulator.pl;h=d958359b2cb6c536fca8aaa445b0d1bb41287563;hb=1c778b24965f06e5ff39ddaf58b66468d1a0f28b;hp=3be7d9bbee5db78935592605b30f6b13445d464d;hpb=9b6b357ae91515323c0c1e6b7a6e2b1d28e45c08;p=Biblio-SIP2.git diff --git a/sc-emulator.pl b/sc-emulator.pl index 3be7d9b..d958359 100755 --- a/sc-emulator.pl +++ b/sc-emulator.pl @@ -3,25 +3,37 @@ use warnings; use strict; -use IO::Socket::INET; -use autodie; - 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 lib 'lib'; +use SIP2::SC; + +my $sc = SIP2::SC->new( $ENV{ACS} || '10.60.0.251:6001' ); + +# login +$sc->message("9300CN$user|CO$password|"); + +# SC Status +$sc->message("9900302.00"); + +$sc->message("6300020091214 085452 AO$loc|AA$patron|AC$password|"); + +# Checkout +$sc->message("11YN20091214 124436 AO$loc|AA$patron|AB$barcode|AC$password|BON|BIN|"); + +# Checkin +$sc->message("09N20091214 08142820091214 081428AP|AO$loc|AB$barcode|AC|BIN|"); -sub sip2 { - my ( $send, $patt ) = @_; - warn ">>>> $send"; - print $sock $send; - my $in = <$sock>; - warn "<<<< $in"; - die unless $in =~ $patt; -} +# checkout - invalid barcode +$sc->message("09N20091216 15320820091216 153208AP|AOFFZG|AB200903160190|ACviva2koha|BIN|"); -sip2 "9300CN$user|CO$password|\n" => qr/^941/; +# status +$sc->message("9900302.00");