Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here


Help needed for Net::SCP::Expect

Help needed for Net::SCP::Expect

Help needed for Net::SCP::Expect

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!

RE: Help needed for Net::SCP::Expect

What line was this error thrown?

Is it moaning regarding your call to new, or as per the other thread on the subject http://www.tek-tips.com/viewthread.cfm?qid=933740

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

RE: Help needed for Net::SCP::Expect

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 http://code.activestate.com/ppm/Net-SCP-Expect/, 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.

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close