In the documentation for Net::OpenSSH I noticed they don't use the capture or die construct but instead check for the error on a seperate line. This made sense once I found the description of what happens during a capture if there is an error. It goes ahead and returns what it has captured so far so the or die... won't be triggered.

When an error happens while capturing (for instance, the operation times out), the partial captured output will be returned. Error conditions have to be explicitly checked using the "error" method. For instance:
my $output = $ssh->capture({ timeout => 10 }, "echo hello; sleep 20; echo bye"); $ssh->error and warn "operation didn't complete successfully: ". $ssh->error; print $output;

Try replacing this line

@output = $ssh->capture($CommandE) or die "remote command failed: +" . $ssh-> +error;
with this and see what happens. I've never used this module but the timeout options might be worth investigating.
@output = $ssh->capture($CommandE); $ssh->error and die "remote command failed or didn't complete successfully: " +. $ssh->error;

There is also the capture2 function to capture both STDERR and STDOUT. I couldn't tell from your command prompt version of the output if there was anything going to STDOUT.

Edit: PS If you put your command output text into code tags<code> ...[text]...</code> then it will just be text and brackets won't be interpreted as links. It will be much easier for us to understand what is going on.

Edit: Using capture with Net::OpenSSH on Cisco routers came up in this node. It looks like salva had some good suggestions.


In reply to Re: Special Characters_CommandOutput by Lotus1
in thread Special Characters_CommandOutput by vasanth.easyrider

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.