Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Help needed for Net::SCP::Expect

Status
Not open for further replies.

YingWang

Programmer
May 17, 2013
2
US
Hi there,

I need to use Net::SCP::Expect to transfer file from one server to another. I am using ActivePerl for my development.

Here is my test code

use strict;
use warnings;
use Net::SCP::Expect;
my $scpe = Net::SCP::Expect->new(host=>$host, user=>$user, password=>$pass, option=>'StrickHostKeyChecking=no',port =>22) || die "ERROR: Uable to login\n";
$scpe->scp('test.txt', '/home/ywang');
print "Done\n";

It gives the following error
Can't locate object method "new" via package "Expect" (perhaps you forgot to load "Expect"?)

There is a thread for the same problem I have, but I could not find the solution from it. Could anyone provide me some advice? Thank you very much!
 
What line was this error thrown?

Is it moaning regarding your call to new, or as per the other thread on the subject
Is Expect installed via PPM?

What package namespace does Expect set in its module?

"In complete darkness we are all the same, it is only our knowledge and wisdom that separates us, don't let your eyes deceive you."

"If a shortcut was meant to be easy, it wouldn't be a shortcut, it would be the way!"

Free Dance Music Downloads
 
Here is the summary of how I get it work. Hope it can help others.

I have ActivePerl Business Edition (PPM) version 5.14 and ActiveState Perl Dev Kit (PDK) version 9.2 installed on my windows system. My perl script that to be run on a Solaris machine needs transfer files to another machine via a non-default secure port.

It seems Net::SCP::Expect module is the perfect candidate.

But Net::SCP::Expect does not show up in the PPM available package list. According to it is available for solaris.

So from a command prompt window, I run "perlapp --target solaris-sparc-32 --target-install Net::SCP::Expect"

Then within PDK, choose Solaris (SPARC,32 bit) as your target, then click MakeExecutable button. If anything module showed up as "Can't locate .. " error, just go to command prompt and run the above command to install that module.

Eventually, you should be able to make your script into executable.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top