Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Perl > Perl Misc > Perl et Telnet

Reply
Thread Tools

Perl et Telnet

 
 
ThERiZla
Guest
Posts: n/a
 
      12-01-2003
Hi,

I do a connection on the server witn Telnet.
My problem is when I execute a command on command prompt.
This is my command : my @outputcreateUser = $telnet->cmd($createUser);
I want obtain the result of the command but when I print the array
@outputCreateUser there is nothing in the array.

This is my code to connect to the server:
## Create a Net::Telnet object
use Net::Telnet ();
$telnet = new Net::Telnet (Timeout => 20,
Input_log => $fileInput,
Output_log => $fileOutput,
Errmode => 'return',
Prompt => $prompt);
if (! defined $telnet) {
die "Unable to create telnet object for $host";
}

$telnet->open($host);
if ($msg = $telnet->errmsg) {
die "Unable to open telnet to $host $msg";
}

$telnet->login($username, $password);
if ($msg = $telnet->errmsg) {
die "Unable to login to $host $msg PWD: $password";
}
return $telnet;


I like know if I do something wrong.
An explication and an example will be appreciate.
Thanks
 
Reply With Quote
 
 
 
 
J. Gleixner
Guest
Posts: n/a
 
      12-01-2003
ThERiZla wrote:
> Hi,
>
> I do a connection on the server witn Telnet.
> My problem is when I execute a command on command prompt.
> This is my command : my @outputcreateUser = $telnet->cmd($createUser);
> I want obtain the result of the command but when I print the array
> @outputCreateUser there is nothing in the array.


ahhh... so your code looks exactly like:

my @outputcreateUser = $telnet->cmd($createUser);
print @outputCreateUser;

Case is important in variable names.

 
Reply With Quote
 
 
 
 
Uri Guttman
Guest
Posts: n/a
 
      12-01-2003
>>>>> "JG" == J Gleixner <> writes:

JG> ahhh... so your code looks exactly like:

JG> my @outputcreateUser = $telnet->cmd($createUser); print
JG> @outputCreateUser;

JG> Case is important in variable names.

another reason why StuDlyCaps is such a bad idea. it is tricky enough
getting long names correct (and strict is a must anyway) but adding case
issues makes it just annoying. i created a copy-word func in emacs long
ago in my personal perl mode that copies a name and preceding sigil so i
can paste it elsewhere. makes life lots easier when using vars multiple
times.

uri

--
Uri Guttman ------ -------- http://www.stemsystems.com
--Perl Consulting, Stem Development, Systems Architecture, Design and Coding-
Search or Offer Perl Jobs ---------------------------- http://jobs.perl.org
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Telnet - attempting to initiate a telnet session within an established telnet session Carcarius Ruby 0 12-06-2007 03:26 AM
Need to talk to a telnet server and send a telnet break Jim Isaacson C Programming 5 11-05-2004 09:17 PM
Tcl equivalent for Perl's Win32::OLE, LWP::UserAgent, HTTP::Request, Net::Telnet Vinay Gupta Perl 2 07-27-2004 12:31 PM
Perl telnet proxy Shuttermutt Perl 0 09-03-2003 10:03 PM
How can I telnet when I dont have specific access to a telnet client Jack B. Pollack Computer Support 4 07-24-2003 08:58 PM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57