LinuxQuestions.org
Support LQ: Use code LQ3 and save $3 on Domain Registration
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices

Reply
 
Search this Thread
Old 03-29-2006, 11:40 AM   #1
mfitzpat
LQ Newbie
 
Registered: Feb 2004
Location: Boston, MA
Distribution: Centos
Posts: 27

Rep: Reputation: 15
correct @INC path not detected by web browser


Hi,

I install RSPerl one of my systems. When I try to run a cgi script, the perl module R.pm can not found. I can run the script manually without any problem. I have manually set the LD_LIBRARY_PATH and PERL5LIB to the correct paths.

System info: running FC3, with apache 2.0.53, and perl 5.8.5.

RSPerl is installed
/usr/lib/R/library/RSPerl.
R.pm is located at
/usr/lib/R/library/RSPerl/share/lib/perl5/site_perl/5.8.5/i386-linux-thread-multi/R.pm

When I try to run the script from /var/www/cgi-bin/mfitzpat via the web browser, the listed paths for finding R.pm in @INC are incorrect.

web browser error:
Can't locate R.pm in @INC (@INC contains: /usr/lib/perl5/5.8.5/i386-linux-thread-multi /usr/lib/perl5/5.8.5.....
EGIN failed--compilation aborted at /var/www/cgi-bin/mfitzpat/example3.pl line 4.

When I check @INC, the path to R.pm it is listed.

/$ perl -e 'print join "\n", @INC'
/usr/lib/R/library/RSPerl/share/lib/perl5/site_perl/5.8.5/i386-linux-thread-multi
as well as /usr/lib/perl5/5.8.5, etc


script fails at line 4
example3.cgi

#!/usr/bin/perl
use CGI qw(:standard);
use CGI::Carp qw(fatalsToBrowser);
use R;

I have tried to append the full path to "use R", but it did not work. Gives a different error.

The httpd.conf relative entries
LoadModule cgi_module modules/mod_cgi.so

ScriptAlias /cgi-bin/ "/var/www/cgi-bin/"

<Directory "/var/www/cgi-bin">
AllowOverride None
# Options None
Options ExecCGI
Order allow,deny
Allow from all
</Directory>

AddHandler cgi-script .c

So, my question is how can I get the correct @INC path for R.pm to be seen by the web browser?

Thank you for any advice.
 
Old 03-30-2006, 08:25 PM   #2
theNbomr
LQ 5k Club
 
Registered: Aug 2005
Distribution: OpenSuse, Fedora, Redhat, Debian
Posts: 5,395
Blog Entries: 2

Rep: Reputation: 903Reputation: 903Reputation: 903Reputation: 903Reputation: 903Reputation: 903Reputation: 903Reputation: 903
Assuming your server is apache, you can modify httpd.conf...



Code:
#
# Environment variable setup
# 
<IfModule mod_env.c>
    # Location of the application-specific perl modules.
    SetEnv YOUR_ENV_VAR /path/to/your/modules
</IfModule>

Then, in your perl code,

Code:
use lib $ENV{YOUR_ENV_VAR};
use yourModule;
There may be a more sanitary solution, but this works for me. I'd be happy to hear of a better method.

I guess you could just do:

Code:
use lib /path/to/your/modules;
....

Sure, why not.

--- rod.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
which is the correct directory path? verbatim Programming 1 04-25-2005 12:22 AM
what are the correct path for ksysv, the SysV-Init Editor? Xavius Slackware 1 01-01-2005 04:11 PM
browser plugin for Konqueror web browser (linspire) Tracianddwayne Linux - Newbie 1 01-01-2005 03:15 PM
Adding the correct installation path mynameisjoe Linux - Newbie 4 05-11-2004 11:26 AM
please tell me if my path statement is correct on RH 7.3 ergo_sum Linux - Newbie 9 12-13-2003 12:41 AM


All times are GMT -5. The time now is 07:59 PM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration