Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic
 
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 scrutinizing the Monastery: (3)
As of 2018-02-24 21:42 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    When it is dark outside I am happiest to see ...














    Results (311 votes). Check out past polls.

    Notices?