Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot

Re: Test Availability of HTTPS Web Application?

by Kanji (Parson)
on May 28, 2002 at 23:57 UTC ( #169935=note: print w/replies, xml ) Need Help??

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.


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
    You're correct, "is_success" is MUCH better (I'm catchin' on.) Here's the rub: https, repeat 's'. Beau
      Go to the link mentioned as "required modules", i.e. Crypt::SSLeay: "OpenSSL glue that provides LWP https support"

Log In?

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://169935]
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others lurking in the Monastery: (2)
As of 2023-03-29 17:05 GMT
Find Nodes?
    Voting Booth?
    Which type of climate do you prefer to live in?

    Results (72 votes). Check out past polls.