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)
45 #warn "# send_receive=",dump( \@send_receive );
47 while ( @send_receive ) {
48 my $send = shift @send_receive;
49 my $expect = shift @send_receive;
51 print $socket "$send\r\n";
54 warn "# send/expect/got ",dump($send,$expect,$got);
56 if ( defined $got && defined $expect && $expect ne substr($got,0,length($expect)) ) {
57 warn "ERROR expected [$expect] got [$got]\n";
59 my $r = <STDIN>; chomp $r;
60 print $socket "$r\r\n";