From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of ukhas
jean
Sent: 20 February 2007 08:05
To: Active Perl
Subject: regarding Net::Telnet

> Hi all ... had a problem executing this script which tries to run a
"who" command on a unix host id01.
>  

'use strict; use warnings;' missing. Always include them at the start of
scripts. Had you included them, you would have seen a warning about a
potential problem with your code.

> use Net::Telnet;
>  
> my $host = "id01";
> my $port = "1800";

Are you sure about that? Just checking, as that isn't the normal telnet
port.

> my $t = new Net::Telnet (Timeout => 10);
> $t->open(Host => $host, Port => $port);
> $t->login("abc", "123");
> my @lines = $t->cmd("^C");
> my @lines = $t->cmd("who");
> print "@lines";
> 
> Its giving me this error:-
> unknown remote host: idl01 at test.pl line 5
>  
> Any idea why this may be happening?? the host id01 can be reached if I
do a manual "telnet id01" from start->
> run.

Hard to say. I notice from the source code that it uses inet_atoi to
look up the ip address of the host. Try using the ip address explicitly
instead of the host name. Also try adding the host to your hosts file
(its location is platform dependant).

> when i do a manual "telnet id01", there is a script that runs from
.profile file ... its by default ... i dont > want to run that script
... hence the use of Ctrl-C or ^C.

Well, that is unlikely to do what you want. First, the login function
waits for a prompt before returning, so your attempt to send Ctrl-C is
too late. Second your attempt to send Ctrl-C actually sends "^" followed
by "C" followed by "\n", which isn't the same thing. Possibly something
like '$p->put("\003"); $p->cmd();' might work.

>  
> Any suggestions are most welcome.

It's always a good idea to read the documentation of the modules and
functions that you use, especially if you are having problems with them.
I have never used the module, the above comments are the result of a
brief glance at the documentation.

HTH

-- 
Brian Raven 

=========================================
Atos Euronext Market Solutions Disclaimer
=========================================

The information contained in this e-mail is confidential and solely for the 
intended addressee(s). Unauthorised reproduction, disclosure, modification, 
and/or distribution of this email may be unlawful.
If you have received this email in error, please notify the sender immediately 
and delete it from your system. The views expressed in this message do not 
necessarily reflect those of Atos Euronext Market Solutions.

Atos Euronext Market Solutions Limited - Registered in England & Wales with 
registration no. 3962327.  Registered office address at 25 Bank Street London 
E14 5NQ United Kingdom. 
Atos Euronext Market Solutions SAS - Registered in France with registration no. 
425 100 294.  Registered office address at 6/8 Boulevard Haussmann 75009 Paris 
France.

L'information contenue dans cet e-mail est confidentielle et uniquement 
destinee a la (aux) personnes a laquelle (auxquelle(s)) elle est adressee. 
Toute copie, publication ou diffusion de cet email est interdite. Si cet e-mail 
vous parvient par erreur, nous vous prions de bien vouloir prevenir 
l'expediteur immediatement et d'effacer le e-mail et annexes jointes de votre 
systeme. Le contenu de ce message electronique ne represente pas necessairement 
la position ou le point de vue d'Atos Euronext Market Solutions.
Atos Euronext Market Solutions Limited Société de droit anglais, enregistrée au 
Royaume Uni sous le numéro 3962327, dont le siège social se situe 25 Bank 
Street E14 5NQ Londres Royaume Uni.

Atos Euronext Market Solutions SAS, société par actions simplifiée, enregistré 
au registre dui commerce et des sociétés sous le numéro 425 100 294 RCS Paris 
et dont le siège social se situe 6/8 Boulevard Haussmann 75009 Paris France.
=========================================

_______________________________________________
ActivePerl mailing list
[email protected]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Reply via email to