Help needed with Net::Telnet

S

Shotoku Taishi

Hi

I would like to run commands remotely using net::telnet from CPAN.

I am trying to run the following:

#!/usr/bin/perl -w
use strict;
use Net::Telnet;

my $host= "Andromeda";
my $username = "Andro";
my $passwd = "stars";


$t = new Net::Telnet (Timeout => 10,
Prompt => '/c:\\\\users\\\\andro>$/i');
$t->open("$host");
$t->login($username, $passwd);
@lines = $t->cmd("ls");
print @lines;

I get the following error message:

Global symbol "$t" requires explicit package name

Thanks

Mike
 
M

Michael Budash

Shotoku Taishi said:
Hi

I would like to run commands remotely using net::telnet from CPAN.

I am trying to run the following:

#!/usr/bin/perl -w
use strict;
use Net::Telnet;

my $host= "Andromeda";
my $username = "Andro";
my $passwd = "stars";

above it look sllike you understand about 'use strict;', but below it
appears you do not...
$t = new Net::Telnet (Timeout => 10,
Prompt => '/c:\\\\users\\\\andro>$/i');

s/b:

my $t = new Net::Telnet (Timeout => 10,
Prompt => '/c:\\\\users\\\\andro>$/i');
$t->open("$host");
$t->login($username, $passwd);
@lines = $t->cmd("ls");

s/b:

my @lines = $t->cmd("ls");
print @lines;

I get the following error message:

Global symbol "$t" requires explicit package name

i'm quite sure you're seeing more than just one such error... but make
the changes and your script should at least compile...

hth-
 
S

Shotoku Taishi

Thank you. At least I got it to compile now. I did not know use strict; was
that strict. :)

Now I get the following error:

timed-out waiting for login prompt at C:\test\mike.pl line 13

Thank you for your help so far.

Mike
 
S

Shotoku Taishi

Hi

If I telnet a Unix box and if I use:

Prompt => '/%/');

I do manage to run the "ls" command on the remote host.

I am having real problems with the Windows prompt.though :-(
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,534
Members
45,008
Latest member
Rahul737

Latest Threads

Top