468,316 Members | 1,994 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,316 developers. It's quick & easy.

Environment variable not defined

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...


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...

Expand|Select|Wrap|Line Numbers
  1. #!/usr/bin/perl
  3. use strict;
  4. use warnings;
  6. BEGIN { $ENV{'LIBPATH'}='/opt/freeware/lib'; }
  7. use LWP::UserAgent;
  9. my $url;
  10. my $Firefox = "Mozilla/5.0";
  11. my $response;
  12. my $ua = LWP::UserAgent->new;
  14. $url=$ARGV[0];
  16. $ua->agent($Firefox);
  18. $response = $ua->get($url);
  20. if ( $response->is_success) {
  21.   print "SUCCESS\n";
  22.   print $response->status_line, "\n";
  23. }
  24. else
  25. { print "NOT A SUCCESS\n";
  26.   print $response->status_line, "\n";
  27. }
Thanks for your help!
Sep 17 '08 #1
3 4231
971 Expert 512MB
Try using the lib pragma.

Sep 17 '08 #2
I've tried to add:

use lib '/opt/freeware/lib';

The folder has been added to @INC, I have confirmed it by adding these lines :

foreach (@INC) {
print "$_\n";

Any other idea?
Sep 18 '08 #3
971 Expert 512MB
Not sure what's wrong. Maybe one of our experts will be able to assist further.

Sep 18 '08 #4

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

6 posts views Thread by Matthew Barnes | last post: by
28 posts views Thread by Christian | last post: by
19 posts views Thread by Vijay Kumar R Zanvar | last post: by
26 posts views Thread by learner | last post: by
4 posts views Thread by Bill Davidson | last post: by
5 posts views Thread by ago | last post: by
reply views Thread by NPC403 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.