Under AIX 5.3, I have created a script that checks URL availability with LWP::UserAgent.
Before I run the script, I must define the variable LIBPATH for my script to know where is the SSL library. Otherwise it won't be able to evaluate https URL. That is working fine...
LIBPATH='/opt/freeware/lib'
I'd like to avoid defining the variable before running the script, but when I try to define the variable at the beginning of the script, the script output says no https support (meaning that the LIBPATH variable has not been defined).
I don't know what's wrong...
Thanks for your help!
Before I run the script, I must define the variable LIBPATH for my script to know where is the SSL library. Otherwise it won't be able to evaluate https URL. That is working fine...
LIBPATH='/opt/freeware/lib'
I'd like to avoid defining the variable before running the script, but when I try to define the variable at the beginning of the script, the script output says no https support (meaning that the LIBPATH variable has not been defined).
I don't know what's wrong...
Code:
#!/usr/bin/perl
use strict;
use warnings;
BEGIN { $ENV{'LIBPATH'}='/opt/freeware/lib'; }
use LWP::UserAgent;
my $url;
my $Firefox = "Mozilla/5.0";
my $response;
my $ua = LWP::UserAgent->new;
$url=$ARGV[0];
$ua->agent($Firefox);
$response = $ua->get($url);
if ( $response->is_success) {
print "SUCCESS\n";
print $response->status_line, "\n";
}
else
{ print "NOT A SUCCESS\n";
print $response->status_line, "\n";
}
Comment