×
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

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

Jobs

Net::SCP::Expect problem

Net::SCP::Expect problem

Net::SCP::Expect problem

(OP)
I'm trying to use Net::SCP::Expect because I'm using a password as opposed to a key in SCP.

My code is fairly straightforward:

CODE

#!c:\Perl\bin\perl.exe

# Rob Waite 10/2004
# Program to automate the process of SCP'ing Descriptions and photos to hi3

use strict;
use warnings;
use Net::SCP::Expect;
use lib "c:/tmp/LIB";
require "funcs.pl";

my $source = "c:/tmp/LIB/test.txt";
my $destination = "/home/Arob";

my $scpe = Net::SCP::Expect->new(host=>'host', user=>'user', password=>'****') || die "ERROR: Unable to log in\n";

$scpe->scp($source, $destination) || die "ERROR: File-upload error";
Unfortunately this is producing the following error:

CODE

Can't locate object method "new" via package "Expect" (perhaps you forgot to load "Expect"?) at C:/Perl/site/lib/Net/SCP/Expect.pm line 163.
Line 186 of Expect.pm is as follows:

CODE

    my $scp = Expect->new;
The error suggests that I'm not loading Expect.pm or it's failing to initialise fully, I copied the source for Expect.pm from here: http://search.cpan.org/src/DJBERG/Net-SCP-Expect-0...

If you can help in any way whatsoever I'd be really grateful, I'm running this under ActiveState's port of Perl 5.8 on Windows XP.


Rob Waite
http://www.hostpipe.co.uk?src=TT

RE: Net::SCP::Expect problem

Have a look at $! in your die statement

Mike

"Deliver me from the bane of civilised life; teddy bear envy."

Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884

RE: Net::SCP::Expect problem

(OP)
Hi Mike,

Unfortunately it doesn't produce the die statement because it dies before it reaches it. I think the problem is with a dodgy install of Expect, I've had problems with its pre-requisites in the past (IO::Tty and IO::Pty). Do you have any idea how these are structured and stored in the Perl/lib directory? This may help solve the problem so that I can get a clean instal of Expect in CPAN.

Thanks in advance.

Rob Waite
http://www.hostpipe.co.uk?src=TT

RE: Net::SCP::Expect problem

No Rob, sorry. You installing expect using ppm? You might try un-installing and re-installing if so (not very helpful I know)

Mike

"Deliver me from the bane of civilised life; teddy bear envy."

Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884

RE: Net::SCP::Expect problem

(OP)

CODE

Microsoft Windows XP [Version 5.1.2600]
(C) Copyright 1985-2001 Microsoft Corp.

C:\Documents and Settings\User>ppm
PPM - Programmer's Package Manager version 3.1.
Copyright (c) 2001 ActiveState SRL. All Rights Reserved.

Entering interactive shell. Using Term::ReadLine::Stub as readline library.

Type 'help' to get started.

ppm> s expect
Searching in Active Repositories
No matches for 'expect'; see 'help search'.

Rob Waite
http://www.hostpipe.co.uk?src=TT

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