X-Git-Url: http://git.rot13.org/?a=blobdiff_plain;f=sc-emulator.pl;fp=sc-emulator.pl;h=e614cec30d83c8023064151e579bec2710302157;hb=584943f3bddc78b99d264b03ff01f4d87d430e6a;hp=3be7d9bbee5db78935592605b30f6b13445d464d;hpb=8db23fa75c8210d2e9ebb0ebf238a45cfc178f72;p=Biblio-SIP2.git diff --git a/sc-emulator.pl b/sc-emulator.pl index 3be7d9b..e614cec 100755 --- a/sc-emulator.pl +++ b/sc-emulator.pl @@ -5,6 +5,7 @@ use strict; use IO::Socket::INET; use autodie; +use Data::Dump qw(dump); our $user = 'sip2-user'; our $password = 'sip2-paasswd'; @@ -15,13 +16,20 @@ our $sock = IO::Socket::INET->new( '10.60.0.251:6001' ); sub sip2 { my ( $send, $patt ) = @_; - warn ">>>> $send"; - print $sock $send; + warn ">>>> ", dump($send), "\n"; + print $sock "$send\r\n"; + $sock->flush; + +# local $/ = "\r"; my $in = <$sock>; - warn "<<<< $in"; + warn "<<<< ", dump($in), "\n"; die unless $in =~ $patt; } -sip2 "9300CN$user|CO$password|\n" => qr/^941/; +# login +sip2 "9300CN$user|CO$password|" => qr/^941/; + +# SC Status +sip2 "9900302.00" => qr/^98/;