$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:

PERL scripts must send the XML header before sending the body of the script.

PERL scripts must provide script data fast enough to prevent the device from timing out.

XML scripts cannot contain the update firmware command, which requires extra work on the part of the PERL script to open the file containing the firmware image and send it to the device.

Only one XML document is allowed per connection, which means one pair of RIBCL tags.

Scripting, command line, and utility options 132