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.
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Re: Test Availability of HTTPS Web Application?
by Beau Landeaux (Novice) on May 29, 2002 at 02:57 UTC | |
by kwoff (Friar) on May 29, 2002 at 09:57 UTC |
In Section
Seekers of Perl Wisdom