Dear
Zaxo,
I had my CPAN installation setting following your
ingenious solution above.
I never has compilation
problem beforehand when running a Perl script (*.pl).
Recently, while trying a CGI script like below (let's call it 'test.cgi').
I had problem compiling it.
#!/usr/bin/perl -w
use CGI ':standard';
use Mail::Sendmail;
Although Mail::Sendmail is successfuly installed,
my CGI script can't recognize the location. I encounter
this strange result.
When I run this:
$ perl -c test.cgi
# it gives
test.cgi syntax OK
But when I run this with taint:
$ perl -cT test.cgi
It gives:
Can't locate Mail/Sendmail.pm in @INC (@INC contains: ~/lib/perl5/site
+_perl/5.8.5/ /usr/lib/perl5/5.8.5/i386-linux-thread-multi /usr/lib/pe
+rl5/5.8.5 /usr/lib/perl5/site_perl/5.8.5/i386-linux-thread-multi /usr
+/lib/perl5/site_perl/5.8.4/i386-linux-thread-multi /usr/lib/perl5/sit
+e_perl/5.8.3/i386-linux-thread-multi /usr/lib/perl5/site_perl/5.8.2/i
+386-linux-thread-multi /usr/lib/perl5/site_perl/5.8.1/i386-linux-thre
+ad-multi /usr/lib/perl5/site_perl/5.8.0/i386-linux-thread-multi /usr/
+lib/perl5/site_perl/5.8.5 /usr/lib/perl5/site_perl/5.8.4 /usr/lib/per
+l5/site_perl/5.8.3 /usr/lib/perl5/site_perl/5.8.2 /usr/lib/perl5/site
+_perl/5.8.1 /usr/lib/perl5/site_perl/5.8.0 /usr/lib/perl5/site_perl /
+usr/lib/perl5/vendor_perl/5.8.5/i386-linux-thread-multi /usr/lib/perl
+5/vendor_perl/5.8.4/i386-linux-thread-multi /usr/lib/perl5/vendor_per
+l/5.8.3/i386-linux-thread-multi /usr/lib/perl5/vendor_perl/5.8.2/i386
+-linux-thread-multi /usr/lib/perl5/vendor_perl/5.8.1/i386-linux-threa
+d-multi /usr/lib/perl5/vendor_perl/5.8.0/i386-linux-thread-multi /usr
+/lib/perl5/vendor_perl/5.8.5 /usr/lib/perl5/vendor_perl/5.8.4 /usr/li
+b/perl5/vendor_perl/5.8.3 /usr/lib/perl5/vendor_perl/5.8.2 /usr/lib/p
+erl5/vendor_perl/5.8.1 /usr/lib/perl5/vendor_perl/5.8.0 /usr/lib/perl
+5/vendor_perl) at temp.cgi line 4.
BEGIN failed--compilation aborted at temp.cgi line 4.
How can I have my cgi script recognize the location of the library? I also tried
using "use lib" construct like this:
#!/usr/bin/perl -w
use CGI ':standard';
use lib "/lib/perl5/site_perl/5.8.5/";
use lib "/lib/perl5/site_perl/5.8.5/i386-linux-thread-multi";
use Mail::Sendmail;
but also gives the same symptom.
Does it has anything to do
to the way I install the module following your approach?
Update:
That may fail to influence a web server's Perl environment. If it does, you can use the SetEnv directive in .htaccess or the server configuration for regular cgi scripts.
Just realized you mentioned about the problem above. But how do you actually "SentEnv directive of server config" in my cgi scripts?
-
Are you posting in the right place? Check out Where do I post X? to know for sure.
-
Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
<code> <a> <b> <big>
<blockquote> <br /> <dd>
<dl> <dt> <em> <font>
<h1> <h2> <h3> <h4>
<h5> <h6> <hr /> <i>
<li> <nbsp> <ol> <p>
<small> <strike> <strong>
<sub> <sup> <table>
<td> <th> <tr> <tt>
<u> <ul>
-
Snippets of code should be wrapped in
<code> tags not
<pre> tags. In fact, <pre>
tags should generally be avoided. If they must
be used, extreme care should be
taken to ensure that their contents do not
have long lines (<70 chars), in order to prevent
horizontal scrolling (and possible janitor
intervention).
-
Want more info? How to link
or How to display code and escape characters
are good places to start.