473,388 Members | 1,400 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,388 software developers and data experts.

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

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


Expand|Select|Wrap|Line Numbers
  1. #!/usr/bin/perl
  2.  
  3. use strict;
  4. use warnings;
  5.  
  6. BEGIN { $ENV{'LIBPATH'}='/opt/freeware/lib'; }
  7. use LWP::UserAgent;
  8.  
  9. my $url;
  10. my $Firefox = "Mozilla/5.0";
  11. my $response;
  12. my $ua = LWP::UserAgent->new;
  13.  
  14. $url=$ARGV[0];
  15.  
  16. $ua->agent($Firefox);
  17.  
  18. $response = $ua->get($url);
  19.  
  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. }
  28.  
Thanks for your help!
Sep 17 '08 #1
3 4344
eWish
971 Expert 512MB
Try using the lib pragma.

--Kevin
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
eWish
971 Expert 512MB
Not sure what's wrong. Maybe one of our experts will be able to assist further.

--Kevin
Sep 18 '08 #4

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

Similar topics

6
by: Matthew Barnes | last post by:
I'm considering submitting a patch for Python 2.4 to allow environment variable expansion in ConfigParser files. The use cases for this should be obvious. I'd like to be able to specify something...
3
by: Albretch | last post by:
that was set up for and/or by this user in the OS. Say, you set WEB_DIR as an environment variable pointing to certain folder or root directory Could you go like this <?xml version='1.0'...
28
by: Christian | last post by:
Another question from a not even newbie: In Unix you can set an environment variable with the command export PYTHONPATH but I would like to set the variable from at .py script. So my question...
19
by: Vijay Kumar R Zanvar | last post by:
Hi clc, I want to know few examples of freestanding environments. -- "There's money in this case, Watson," he continued, glancing out of the window, "if there is nothing else." - A Scandal...
26
by: learner | last post by:
Hi, What is the difference between accessing environment variables through int main(int argc,char *argv,char *envp) and extern char **environ;
4
by: Bill Davidson | last post by:
All: I've found the 'Environment.GetEnvironmentVariable()' method; but how do I create and/or set an environment variable? Thanks, Bill
2
by: ANarula | last post by:
I am running into a strange problem. I have perl script which reads the "APPDATA" environment variable, and does some work on that directory. When I a launch this script from Command Prompt, it...
1
by: Shawn Milochik | last post by:
Here's a more "English" version of what people are trying to explain: When you log into a Unix session, certain files in your home directory are read and add environment variables to your...
5
by: ago | last post by:
Dear all, These days I often find myself using working-env.py, virtual-python.py & co. The main reason in most cases is to insulate my working environment so that I can use custom site-package...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.