Net::Telnet $prematch, $match



Hello,
I am looking at a code fragment that I dont understand properly.
...
my ($prematch, $match) = $telnet->waitfor('/login: $i);
$telnet->print($user);
if (($prematch, $match) =$telnet->waitfor(string=> 'Choose a new
password'))
{
crash out - cannot go on
}
my ( $prematch, $match) = $telnet->waitfor('/password: $/i);
my($prematch, $match) = $telnet->print($password);
....

So what I do understand is line1 we wait for "login: " case
insensitive.
Then line2 supply the user - ($prematch, $match) not used at this
point.
line 3 - i am not really sure - $prematch contains the match up to
expression and $match the match expression but what is the if
statement comparing?
And how if we dont get the 'Choose new password' do we continue to
provide the password?

Actually I need to extend this program to do very similar things - is
there an alternative way of doing this?

TIA

Ton

.



Relevant Pages

  • Re: Net::Telnet $prematch, $match
    ... On 04/12/2007 09:18 AM, ton de w wrote: ... I am looking at a code fragment that I dont understand properly. ... crash out - cannot go on ...
    (comp.lang.perl.modules)
  • Re: Net::Telnet $prematch, $match
    ... I am looking at a code fragment that I dont understand properly. ... check for a Timeout parameter in the call to new. ... check for a Errmode parameter or a call to errmode. ...
    (comp.lang.perl.modules)
  • Re: WMP crashes when it plays files on MY account, but not others.
    ... per-user. ... Is there any particular thing you're doing that causes a crash... ... So the problem is with my account. ... something, and I dont get a bucket number, i dont get the option to send ...
    (microsoft.public.windowsmedia.player)
  • Re: I made a boo boo...
    ... > I created a do loop that i cant get out of.how can i crash the ... > program?i dont want to lose data and because im on a computer in Uni, ...
    (microsoft.public.vb.general.discussion)
  • Re: Fwd: Please post this anonymously (without my email-address and such)
    ... As does a crash of Office XP products, ... IE Bug Reporting requires you to click a button to ... > At this point I dont see this scenario as a threat. ... though you'd have to get the virus to ...
    (Vuln-Dev)