I put together Net::SSH2::Cisco from Net::Telnet, Net::Telnet::Cisco and Net::SSH2. You'll find the same limitations apply, specifically from Net::Telnet::Cisco:

http://search.cpan.org/~joshua/Net-Telnet-Cisco-1.10/Cisco.pm#Sending_multiple_lines_at_once

If your command doesn't produce the regular prompt in return, you'll have an issue. When I try this on a 7200-series, I get:

R1#copy startup-config tftp://192.168.100.254 Address or name of remote host [192.168.100.254]? Destination filename [r1-confg]?

which will *DEFINITELY* be the cause of an issue since the prompt is not returned without pressing enter a few times. Try adding "\n\n\n" to the end of your cmd() 'String' value.

I see you're using waitfor() looking for "#", is that your prompt?

Did you try setting timeout() before issuing your cmd() calls? I see you have a 5 second timeout *after* the command is issued - that won't help. Try timeout(10) *before* issuing cmd().

Also, reading the POD from Net::Telnet and Net::Telnet::Cisco is highly recommended since I didn't port all the POD into this module and there are helpful examples about how to use those modules from which Net::SSH2::Cisco is based on.


In reply to Re: Using Net::SSH2::Cisco by VinsWorldcom
in thread Using Net::SSH2::Cisco by mroe1234

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.