http://qs1969.pair.com?node_id=169935


in reply to Test Availability of HTTPS Web Application?

I'm not sure why you need to 'reverse engineer' legacy Perl code (decipher, maybe ;^), but your right in thinking there's a better way ... well, simpler anyway.

#!/usr/bin/perl -w use strict; use LWP::UserAgent; use HTTP::Request::Common qw/ GET /; my $url = shift; my $browser = LWP::UserAgent->new; my $response = $browser->request( GET $url ); print $response->code;

Personally, I think $response->is_success would be more beneficial as 200 isn't the only response indicating success, but that's your call...

One caveat, tho:- test against a known good site before anything else ... LWP::UserAgent returns a 500 error instead of undef if you don't have have the modules necessary to talk to SSL (aka https) servers.

    --k.