in reply to how to get back a exit status using Net::Telnet

Regarding Net::FTP, you can't run a perl script on the remote server, but you can certainly apply error checking to any Net::FTP method you're calling (from the Net::FTP manpage):
$ftp->cwd("/pub") or die "Cannot change working directory ", $ftp->message;
Regarding Net::Telnet, a command executed on the remote side will return its output lines (from the Net::Telnet manpage):
@lines = $t->cmd("who");
If your script on the remote side prints messages when it encounters an error, just check if @lines matches this pattern. Additionally, you could add echo $? to have the remote side print the exit code of the remote command/script right after it's done:
@lines = $t->cmd('who; echo status=$?');
Then grep for /status=\d+/ in @lines.

Replies are listed 'Best First'.
Re^2: how to get back a exit status using Net::Telnet
by fraterm (Scribe) on Jan 18, 2005 at 02:50 UTC
    I tend to pop() off, for example:
    @list = $t->cmd('who; echo $?'); $return_code_scalar=pop(@list);
    rather than grep for a pattern in the output list.
    Squibbie Pooh Ski Doo.
Re^2: how to get back a exit status using Net::Telnet
by Eyck (Priest) on Jan 18, 2005 at 11:41 UTC

    Actually FTP supports running commands on remote side, check RFCs, and that was one of the earliest usage scenarios for FTP.