Mombu the Programming Forum

Go Back   Mombu the Programming Forum > Programming > Perl can't locate a .pm in @INC
User Name
Password
REGISTER NOW! Mark Forums Read




Reply
1 23rd October 19:54
the-smtpguy
External User
 
Posts: 1
Default Perl can't locate a .pm in @INC



Hello all again,

I'm not much of a perl programer but I am trying to get this script to
run and it is giving me a headache

I'm getting premature end of script header errors and I'm pretty sure
why.

Here is everything I think is important for this situation, if i'm
missing something please let me know and I'll supply anything else.

I have some .pm files ina directory called /home/mach10/dist/lib

the first line of the script calls
use lib ($ENV{'MACH10_LIB'} || '/home/mach10/dist/lib');

then it calls the offending module:
use Skyweb;

seems like that should work for me ( with my limited knowledge )
now if i try to run the script from browswer i get the follow error in
my apache logs:

Can't locate Skyweb.pm in @INC (@INC contains: /home/mach10/dist/lib
/usr/lib/perl5/5.8.0/i386-linux-thread-multi /usr/lib/perl5/5.8.0
/usr/lib/perl5/site_perl/5.8.0/i386-linux-thread-multi
/usr/lib/perl5/site_perl/5.8.0 /usr/lib/perl5/site_perl
/usr/lib/perl5/vendor_perl/5.8.0/i386-linux-thread-multi
/usr/lib/perl5/vendor_perl/5.8.0 /usr/lib/perl5/vendor_perl .) at
/usr/local/apache/cgi-bin/sp/mach10.pl line 4.
BEGIN failed--compilation aborted at
/usr/local/apache/cgi-bin/sp/mach10.pl line 4.
[Tue Nov 4 16:23:16 2003] [error] [client 192.168.1.101] Premature
end of script headers: /usr/local/apache/cgi-bin/sp/mach10.pl


I'm so novice to perl that i'm completely lost....anyone have any
ideas.

Thanks for all the help in advance.

Gary
  Reply With Quote


 


2 23rd October 19:55
james e keenan
External User
 
Posts: 1
Default Perl can't locate a .pm in @INC



The 'use lib' command is expecting a *list* of directories in which to
search for Perl modules. Items in the list are, in almost all cases,
separated by commas. You are separating the items in your list by Perl's ||
operator. This would be correct if this were the body of, say, an 'if'
condition, but it's not a Perl list. Try:
use lib ($ENV{'MACH10_LIB'} , '/home/mach10/dist/lib');
and let us know the results.

jimk
  Reply With Quote
3 23rd October 19:55
gunnar hjalmarsson
External User
 
Posts: 1
Default Perl can't locate a .pm in @INC


I don't understand that, Jim. Thought that the expression within
parentheses returned a 'LIST', even if it happens to consist of only
one element: It returns either the value of $ENV{'MACH10_LIB'}, or, if
that value is not true, the string '/home/mach10/dist/lib'.


Doesn't that tell us that OP's "use lib" statement worked?

Nevertheless, I'm not able to suggest a solution.

--
Gunnar Hjalmarsson
Email: http://www.gunnar.cc/cgi-bin/contact.pl
  Reply With Quote
4 23rd October 19:55
tadmc
External User
 
Posts: 1
Default Perl can't locate a .pm in @INC


^^^


But you are not going to tell us?

Is this a test? :-)

An essential missing bit of information is where _is_ Skyweb.pm installed?

If it is at

/home/mach10/dist/lib/Skyweb.pm

then I don't know what the problem might be...


--
Tad McClellan SGML consulting
tadmc@augustmail.com Perl programming
Fort Worth, Texas
  Reply With Quote
5 23rd October 19:55
jwillmore
External User
 
Posts: 1
Default Perl can't locate a .pm in @INC


<snip>

You could just set the $ENV{'MACH10_LIB'} variable _first_, then set
the 'lib' path accordingly.

--untested--
$ENV{'MACH10_LIB'} = '/home/mach10/dist/lib' unless defined
$ENV{'MACH10_LIB'};
use lib "$ENV{'MACH10_LIB'}";
--untested--

HTH

Jim
(jwillmore _at_ adelphia _dot_ net)
  Reply With Quote
6 23rd October 19:55
darin mcbride
External User
 
Posts: 1
Default Perl can't locate a .pm in @INC


How about running it manually? If that doesn't work, then you don't
have Skyweb.pm where you claim to above ;-)

If it does, and under the assumption that you're not lying/deceived
about the above I would have to assume it will work, you've just hit
one of my personal most-frequently-hit problem that bites me nearly
every time I start a new web app. Permissions.

Generally, the web server runs as "apache" or some other user. Not as
you. And that user probably doesn't have read/execute permissions in
one or more of /home, /home/mach10, /home/mach10/dist, or
/home/mach10/dist/lib. Or it may not have read permissions to the
module in question, but in that case I believe you'd get a different
error message than this, so I would bet on the directories.


I do not think this is a perl issue per se, but a unix one.
  Reply With Quote
7 23rd October 19:56
james willmore
External User
 
Posts: 1
Default Perl can't locate a .pm in @INC


On Wed, 05 Nov 2003 02:13:38 +0100

<snip>


<snip>

You're right. I posted something similar as a solution, but you're right.

Nor can I :-(

--
Jim

Copyright notice: all code written by the author in this post is
released under the GPL. http://www.gnu.org/licenses/gpl.txt
for more information.

a fortune quote ...
Pascal Users: To show respect for the 313th anniversary
<(tomorrow) of the death of Blaise Pascal, your programs will be
run at half speed.
  Reply With Quote
8 23rd October 19:57
the-smtpguy
External User
 
Posts: 1
Default Perl can't locate a .pm in @INC


Well i got lazy, and fixed the problem the good old fashion way.

I just copied the .pm's to my /usr/lib/perl5/5.8.0 directory and it
works, outside of my previous post with <INFILE> errors ( which i have
no clue about), but that is left for another post

Cheers and Thanks to all for the replies, they were most helpful

Gary
  Reply With Quote
Reply


Thread Tools
Display Modes




666