So, the Perl knows where my *.pm files are. Unfortunately, Apache doesn't know that

Actually, your statement there is not quite correct. It's not Apache that doesn't know where the module is, it is indeed Perl. Perl is the one who placed that error message in the Apache log, so for some reason Perl is confusing itself (or you have confused it). As the error message shows, Perl isn't seeing that c:/Apache/htdocs/mokslas/lib is part of @INC. Can I ask why you have PERLLIB="C:/Apache/htdocs/mokslas/lib" in the output of perl -V? (Read last paragraph for reason of strikeout)

I'm quite curious as to why perl shows the directory as part of @INC within perl -V but why the added directory into @INC isn't being passed into the interpreter. The only way I can understand why this might happen is the following: do you have more than one installation of perl on the machine involved? If, for example, you have both perl 5.6.1 and perl 5.8.0 installed, and you modified the @INC for perl 5.6.1 and your script is loading perl 5.8.0, then perhaps perl versions keep seperate @INCs? The only scenerio that came instantly to mind...

UPDATE, 5 seconds later: I believe the correct environment variable is PERL5LIB, not PERLLIB. Somebody correct me if I am wrong.

UPDATE, several minutes later...: As This external page suggests, it seems that PERLLIB and PERL5LIB are both valid for this use. I'm still perplexed as to why perl is getting confused on your machine. But now I've half-thought of something else. Do you have Mokslas.pm in C:/Apache/htdocs/mokslas/lib or just in C:/Apache/htdocs/mokslas? I'm wondering if perhaps you just imitated the current @INC values by appending the /lib part on... however, that still does not explain the fact that the error logged does not mention the fact that the new directory is there... {still confused}

Last, Final Update: Apparently it truly *IS* Apache that is at fault here. It seems (just learned from PodMaster via the CB) that Apache strips the environment variables on handing execution to Perl. It is for security purposes that this is done. pulls certain environment variables and doesn't even look at the rest of them. Thus Apache only import the environment variables that it is interested in. I really don't know much on the subject, discuss it with PodMaster if you wish to know more (he seems to understand it quite well). Therefore, use the 'use lib' functionality already suggested, or if possible, why not move your custom modules into C:/Perl/Site/Lib/Some/Module?


In reply to Re: Setting the @INC variable for Apache running on Windows by Coruscate
in thread Setting the @INC variable for Apache running on Windows by Heidegger

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.