Hello Brian et al ...
 
I rewrote the code to this :-
 
use strict;
use warnings;
use Net::Telnet ();
my $t = new Net::Telnet (Timeout => 30);
                          #Prompt => '/bash\$ $/');
                         
my $username = "jenson";
my $passwd = "abc";
    $t->open("viewserver");
    #$t->login($username, $passwd);
   
    $t->login(Name => $username,
           Password => $passwd);
   
   my @lines = $t->cmd("who");
    #print @lines;
   
    my $aa = $t -> dump_log;
    print $aa;
    #input_log();
I tried using dump_log and input_log as described in the documentation ...
 
But it still doesnt work ...
 
PS:: when i manually login to my server ... it gives me a list of oracle versions to choose from ... I have to do a ctrl-C to goto the korn shell ....
Would this be a problem for my script???
 
Regards,
Jenson Samuel
 

Brian Raven <[EMAIL PROTECTED]> wrote:
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of ukhas
jean
Sent: 25 August 2006 05:55
To: Active Perl
Subject: query on net::telnet module

> Hello All,
>
> I am trying to open a telnet session to a unix machine called
"viewserver" and execute a command , say "who",
> and dump its results on my dos-prompt using the foll. code (But i ran
this code from winXP.):-
>
> use Net::Telnet ();
> $t = new Net::Telnet (Timeout => 100,
> Prompt => '/bash\$ $/');
>
> $username = "jenson";
> $passwd = "abc";
> $t->open("viewserver");
> $t->login($username, $passwd);
>
> @lines = $t->cmd("who");
> print @lines;
>
> It shows me an error :
> timed-out waiting for command prompt at telnet.pl line 8.
>
> In the documentation ... its mentioned that the login () function
depends on the
> "PROMPT" parameter ...
>
> 1. Do i need to increase my timeout-period?? i tried tht ... it doesnt
help.
> 2. by default ... if I go from start->run and type "telnet viewserver"
and then login ....
> it goes to the korn shell ...
> I tried renaming the word "bash" to "ksh" ... in the above script and
it doesnt work ...
>
> Can someone guide me with the "PROMPT" parameter ... i believe thats
where the problem is ... ??
>
> Any suggestions/look-up advises would be highly appreciated.

First, try not using the Prompt parameter at all. The default value may
work just fine.

If it doesn't use the debugging tools provided by the module to help you
work out what the prompt pattern should be (e.g. input_log) as discussed
in the Debugging section of 'perldoc Net::Telnet'. If you have problems
with that, show us the debug output and what you have tried and we might
be able to help.

Also important, always use "use strict" and "use warnings", even if the
code you copied from the documentation doesn't. It is just an example
after all, and is allowed to take some short cuts in the name of
brevity.

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.

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.

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


Get your own web address for just $1.99/1st yr. We'll help. Yahoo! Small Business.
_______________________________________________
ActivePerl mailing list
[email protected]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Reply via email to