Hi, I wrote a script to test if a http server is OK.
My method is :
- telnet to por 80
- send any text

If the http server is OK, it will return "some" text, and should contain string </html>

So, I assume, if I can catch </html>, then my http server is OK.

Here is my perl script:

   use Net::Telnet;

   sub error {
     print -255;
     exit(0);
   }

   print "Testing http at $ARGV[0]\n";

   $telnet = new Net::Telnet ( Timeout=>30, Port=>80, Errmode=>error );
   $telnet->open($ARGV[0]);
   $telnet->print('TESTING');
   $telnet->waitfor('/<\/html>/');
   print 0;

The problem is, it always result -255 ... sub error called.
However, if I set Errmode=>'die', it will result 0.

Anyone know how to setup Errmode with a subroutine?

And, is my method good for testing http server? I just want as simple as possible.

Thanks,
kapot

__________________________________________________
Do you Yahoo!?
Yahoo! Mail Plus – Powerful. Affordable. Sign up now.
http://mailplus.yahoo.com

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to