Perl Scripting

259

$n++;

$reply .= $lastreply;

$lastreply = Net::SSLeay::read($ssl); die_if_ssl_error("ERROR: ssl read"); if($lastreply eq "")

{

sleep(2); # wait 2 sec for more text. $lastreply = Net::SSLeay::read($ssl);

last READLOOP if($lastreply eq "");

}

sleep(2); # wait 2 sec for more text. $lastreply = Net::SSLeay::read($ssl); last READLOOP if($lastreply eq "");

}

print "READ: $lastreply\n" if $debug; if($lastreply =~ m/STATUS="(0x[0-9A- F]+)"[\s]+MESSAGE= '(.*)'[\s]+\/>[\s]*(([\s].)*?)<\/RIBCL>/)

{

if($1 eq "0x0000")

{

print STDERR "$3\n" if $3;

}

else

{

print STDERR "ERROR: STATUS: $1, MESSAGE: $2\n";

}

}

}

$reply .= $lastreply; closeSSLconnection($ssl); return $reply;

}

PERL scripts can also send a portion of the XML script, wait for the reply, and send more XML later. Using this technique, it is possible to use the reply produced by an earlier command as input to a later command. However, the PERL script must send data within a few seconds or the device will time out and disconnect.

When using the XML scripting interface with PERL scripts, the following restrictions apply: