waitfor" - HELP Needed"/>

Net::Telnet - Problems using "script->waitfor" - HELP Needed

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

Hello All,
               I am having problems getting my Perl script to detect
different login scenarios in a unix environment. My code will work OK
for one box but every now and then a box will be configured differently
and the login prompts will be different, catering for this eventuality
in my script is where I am struggling, here is a snippet of the code:-

sub Telnet_To_Device
    $script = new Net::Telnet ( Timeout=>5, Errmode=>'return', Prompt =>
    if (!($script->open(@Data[1])))
                 print "FAILED TO CENNECT TO @Data[1]\n";
    } else {
        $script->waitfor('/Do you understand/i');


As I said this will work for 80% of my machines but for the other 20%
there is a sticking point at the point just after where I input the
password, for these 20% of boxes they do not prompt the user for "Do
you understand" and expect the user to return either "Y/N" they go
straight to the box shell prompt. How can I get the code to say if you
see this then do this or if you see that then do that, an 'IF'
statement basically, the only way I can see this working is if you have
a list of the boxes that do this and then you can use an IF on the box
names to present different logins, this seems to long winded though,
there must be an easier route.

p.s. I have read the PM file before anyone asks, I could not find the
answer there.

Cheers, Mark.

Site Timeline