5 use Data::Dump qw(dump);
9 my $ip = shift @ARGV || '127.0.0.1';
10 my $port = shift @ARGV || 4096;
12 my $socket = IO::Socket::INET->new(
16 ) or die "ERROR $ip:$port - $!";
18 warn "# connected to $ip:$port\n";
20 my @send_receive = grep { /^.+$/ } split(/\n/, q{
21 .SQ 3.2.9 SQPR8463332F62E
30 .CARD E009000000009999
31 .CARD OK Ime Prezime (nobody@example.com)
54 #warn "# send_receive=",dump( \@send_receive );
56 while ( @send_receive ) {
57 my $send = shift @send_receive;
58 my $expect = shift @send_receive;
60 print $socket "$send\r\n";
63 warn "# send/expect/got ",dump($send,$expect,$got);
65 if ( $expect ne substr($got,0,length($expect)) ) {
66 warn "ERROR expected [$expect] got [$got]\n";
68 my $r = <STDIN>; chomp $r;
69 print $socket "$r\r\n";