Before anyone else mentions it - please add the
"use NET::Telnet" in the example.

I told you it was untested.  ;-)

Carter.

> -----Original Message-----
> From: Carter Thompson 
> Sent: Tuesday, September 17, 2002 10:22 AM
> To: Jitendra Soam; [EMAIL PROTECTED]
> Subject: RE: NET::Telnet
> 
> 
> 
> 
> 
> The Prompt is a regular expression that matches the
> commandline prompt from the remote shell.  That means
> you'll want to match the prompt for the user you are
> logging in as.  If I log into one of my remote windows
> machines through a telnet server and I see I have a 
> prompt like so, "C:/" I'll need to match that within
> my code as prompt.
> 
> If the prompt isn't matched in the time specified in 
> Timeout then the script will either return false or
> die based on what Errmode is set to, return or die
> respectively.  
> 
> NET::Telnet Defaults:
> Timeout = 10
> Host = "localhost"
> Errmode = "die"
> Prompt = "/[\$%#>]$/"  # matches most unix shells.
> Port = 23
> 
> This is how you could establish a connection with a 
> windows machine with NET::Telnet (Untested).
> 
> use strict;
> 
> my $TIMEOUT = 30;
> my $PROMPT = "C:/";   
> my $HOST = "foobar.foo.com";
> my $USER = "Bob";
> my $PASS = "password";
> 
> $telnet = Net::Telnet->new( Timeout => $TIMEOUT,
>                                   Prompt  => $PROMPT,
>                                   Host    => $HOST,
>                                   Errmode => "return");
> 
> $telnet->login($USER, $PASS);
> 
> # Test here for success if using "return".
> my $msg = $telnet->errmsg();
> if ($msg) {
>       print "$msg\n";
>       $telnet->close;
>       # do whatever you want here.
> }
> 
> 
> 
> Hope this helps.
> 
> Cheers,
> 
> Carter.
> 
> 
> > -----Original Message-----
> > From: Jitendra Soam [mailto:[EMAIL PROTECTED]]
> > Sent: Tuesday, September 17, 2002 7:39 AM
> > To: [EMAIL PROTECTED]
> > Subject: RE: NET::Telnet
> > 
> > 
> > 
> > Thanks.
> > 
> > But the what should be used as prompt?
> > 
> > 
> > 
> > -----Original Message-----
> > From: Thomas R Wyant_III [mailto:[EMAIL PROTECTED]] 
> > Sent: Tuesday, September 17, 2002 7:01 PM
> > To: [EMAIL PROTECTED]
> > Subject: Re: NET::Telnet
> > 
> > 
> > 
> > "Jitendra Soam" <[EMAIL PROTECTED]> wrote:
> > 
> > > Is it possible to use Net::Telnet module to telnet into Windows
> > > machine running Microsoft Telnet Service..
> > 
> > In theory, yes, _provided_ the Telnet service is set up to do
> > username/password authentication. This is not the default.
> > 
> > In practice, there appear to be significant problems 
> figuring out what
> > you
> > should tell it the prompt string is, because Microsoft embeds 
> > all sorts
> > of
> > escape sequences in it.
> > 
> > > and start Any program like Notepad on target machine?
> > 
> > In theory, yes. In practice, of course, Notepad displays on 
> the target
> > machine's desktop, which probably does you as the owner of 
> the telnet
> > link
> > no good at all.
> > 
> > Tom Wyant
> > 
> > 
> > 
> > This communication is for use by the intended recipient and 
> contains 
> > information that may be privileged, confidential or 
> copyrighted under
> > applicable law.  If you are not the intended recipient, you 
> are hereby
> > formally notified that any use, copying or distribution of 
> > this e-mail,
> > in whole or in part, is strictly prohibited.  Please notify 
> the sender
> > by return e-mail and delete this e-mail from your system.  Unless
> > explicitly and conspicuously designated as "E-Contract Intended",
> > this e-mail does not constitute a contract offer, a contract 
> > amendment,
> > or an acceptance of a contract offer.  This e-mail does not 
> constitute
> > a consent to the use of sender's contact information for direct
> > marketing
> > purposes or for transfers of data to third parties.
> > 
> >  Francais Deutsch Italiano  Espanol  Portuges  Japanese  
> > Chinese  Korean
> > 
> >             http://www.DuPont.com/corp/email_disclaimer.html
> > 
> > 
> > _______________________________________________
> > Perl-Win32-Users mailing list
> > [EMAIL PROTECTED]
> > To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
> > _______________________________________________
> > Perl-Win32-Users mailing list
> > [EMAIL PROTECTED]
> > To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
> > 
> _______________________________________________
> Perl-Win32-Users mailing list
> [EMAIL PROTECTED]
> To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
> 
_______________________________________________
Perl-Win32-Users mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Reply via email to