Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:

Hello everyone I am having problems with syntex running a telnet print command and capturing the return error code. The Net::Telnet module examples are somewhat limited. The Here is an example of what I am trying to do;
$telnetobj->prompt('/ > /'); $telnetobj->waitfor('/ > /'); $telnetobj->print ("/root/app_backup/tngtest");
How do I capture the error if the print receives a failed execution? Help is greatly appreciated.

2005-03-11 Janitored by Arunbear - added code tags, as per Monastery guidelines

Replies are listed 'Best First'.
Re: Using Net::Telnet;
by castaway (Parson) on Mar 11, 2005 at 17:45 UTC
    You might want to give an example of what output you get.. Do you get any errors, or just no response at all? What happens if you add DEBUG => 1 to your new() call?

    C.

      Thank you for your responce. I get nothing from the addition of the Debug => 1. If I follow the error protocal of Net::Telnet I get "die" return whether the command completes or not. Must be the syntex I am using. Still can't get it to work. Very frusterating.
      I attempted to run the following according to the Net Use module instruction $telnetobj->cmd($string); $mode = $telnetobj->cmd(String => $string, Output => my $ref, Errmode => $mode); The $mode comes back with 1 whether the command completes remotely or not.
Re: Using Net::Telnet;
by ww (Archbishop) on Mar 11, 2005 at 16:57 UTC
    Please use code tags. If you don't know about those, please read Tutorials -- or, at least, the top couple "about the Monastery."
    Thanks.
    Update: and thanks to 'bear for quick markup! And to OP for acknowledging.
      Thank you