<?xml version="1.0" encoding="windows-1252"?>
<node id="579968" title="unexpected use lib behavior" created="2006-10-23 05:38:06" updated="2006-10-23 01:38:06">
<type id="115">
perlquestion</type>
<author id="351094">
davidj</author>
<data>
<field name="doctext">
Fellow monks, &lt;BR&gt;
I'm getting unexpected behavior using &lt;code&gt; use lib; &lt;/code&gt;
It seems that the only directory my module can be found in is a subdirectory of the directory out of which the pages are being served. Also, when I don't &lt;code&gt; use lib; &lt;/code&gt; and put the module in my PERL5LIB directory, Perl complains that it cannot be found. I have verified that all is setup correctly. Here is what I have: (in the script)
&lt;code&gt;
use lib "/home/davidj/perl/lib/survey";
&lt;/code&gt;

directory listing:
&lt;code&gt;
andromeda:davidj lib &gt; pwd
/home/davidj/perl/lib/survey
andromeda:davidj survey &gt; ls -l
total 4
-rw-r--r-- 1 davidj users 1444 Oct 23 03:09 survey.pm

&lt;/code&gt;

http error output:
&lt;code&gt;
[Mon Oct 23 03:23:49 2006] [error] [client 127.0.0.1] Can't locate survey.pm in @INC (@INC contains: /home/davidj/perl/lib/survey /usr/lib/perl5/site_perl/5.8.8/i386-linux-thread-multi .....
&lt;/code&gt;

I have tested other directories and nothing seems to work. However, if I do this:
&lt;code&gt;
use lib "/var/www/cgi-bin/survey/lib/";
&lt;/code&gt;

and put the module file in that directory, with the pages being served out of /var/www/cgi-bin/survey, it all works fine.&lt;BR&gt;&lt;BR&gt;
It is fine for me to store modules in the application subdirectories. I'm just wondering why Perl cannot find them anywhere else, including my exported PERL5LIB directory.&lt;BR&gt;&lt;BR&gt;
davidj</field>
</data>
</node>
