in reply to Re: Personal library with CPAN
in thread Personal library with CPAN

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/ 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?

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?