perlquestion
Rhys
Okay, so I have this really nasty problem and I'm getting a bit frustrated with it, which may be part of the problem, but here goes:
<p>
So there are currently two options if you want to use SCP in Perl:
<p>
<ol>
<li><code>use Net::SCP; # Doesn't allow passwords.</code></li>
<li><code>use Net::SCP::Expect; # Passwords okay.</code></li>
</ol>
<p>
So I need to scp the files <code>/flash/config.cfg</code> and <code>/flash/boot.cfg</code> from a <b>bunch of switches</b> - not servers - using SCP. I can get the switch IPs, user name, and password into the script, but then it starts to run into problems.
<p>
First, I can't use Net::SCP because I can't set up keys on the switches for logistical reasons. (Many users need to use this script and in addition to certain keygen limitations on the switch, I don't want to maintain that many keypairs).
<p>
Second, Net::SCP::Expect seems to croak() after the first (successful) file transfer, and I'm having a tough time figuring out why it isn't working. There are some errors that appear, but they pile on top of each other on one line.
<p>
To complicate matters, every time one of these switches gets rebooted, the host key is regenerated. Messy...
<p>
Anyway, Net::SCP::Expect does have an error_handler method that takes a coderef, but it's unclear on what exactly is passed to that sub. I'm about to try Data::Dumper on @_ to see.
<p>
Any other ideas or suggestions? Anybody have any direct experience with this kind of thing and either Net::SCP or Net::SCP::Expect?
<p>
--J
<p>
<b>Update:</b> Added tags to highlight the fact that I am not using SCP to talk to a unix host, which is the source of most of the limitations in this problem.
<p>
<b>Update 2:</b> This has been [id://391225|solved]. See below or click the link.