Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much
 
PerlMonks  

Re: Facing problem with Telnet

by glide (Pilgrim)
on Jan 11, 2008 at 09:38 UTC ( #661840=note: print w/replies, xml ) Need Help??


in reply to Facing problem with Telnet

Hi,

You can use the method waitfor, for example:

my $pre_pass_prompt = q{Do \s you \s want \s to \s send \s anyway}; # save the current prompt my $current_prompt = $obj->prompt; # wait for the prompt $obj->waitfor(Match => m{$current_prompt}smx, Match => $pre_pass_prompt); # # check if the last prompt matched it's the $pre_pass_prompt if ($obj->last_prompt() =~ m{$pre_pass_prompt}smx) { # send the reply $obj->cmd(q{y}); }
in many cases the login process have to be done using the waitfor, you can find more information about that in the Net::Telnet.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://661840]
help
Chatterbox?
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others contemplating the Monastery: (4)
As of 2018-06-21 18:25 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Should cpanminus be part of the standard Perl release?



    Results (118 votes). Check out past polls.

    Notices?