Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery
 
PerlMonks  

Strange problem when I install CPAN module to my own directory

by iwanthome (Beadle)
on Apr 16, 2004 at 02:13 UTC ( [id://345607]=perlquestion: print w/replies, xml ) Need Help??

iwanthome has asked for the wisdom of the Perl Monks concerning the following question:

After download Config::General module from CPAN, I decided to install it to my own directory(just copy Config::General.pm to the directory,I didn't do normal install procedure)

I write a simple test script. It can execute in unix shell.But it can't work when access it by http.Apache will report

Can't locate Config/General.pm in @INC (@INC contains: ../lib /usr/loc +al/lib/per l5/5.8.2/sun4-solaris /usr/local/lib/perl5/5.8.2 /usr/local/lib/perl5/ +site_perl/ 5.8.2/sun4-solaris /usr/local/lib/perl5/site_perl/5.8.2 /usr/local/lib +/perl5/sit e_perl .) at /data/zht/perl/cgi-bin/config line 3. BEGIN failed--compilation aborted at /data/zht/perl/cgi-bin/config lin +e 3. [Fri Apr 16 09:31:06 2004] [error] [client 99.1.64.71] Premature end o +f script h eaders: /data/zht/perl/cgi-bin/config

But why it can find the pm when execute at unix shell ?

So are there any special when script execute at cgi envionment? thanks!

$ pwd /data/zht/perl/cgi-bin $ config Content-type: text/html ok$ more config #!/usr/bin/perl use lib '../lib'; use Config::General; print "Content-type: text/html\n\n"; print "ok"; $ $ ls ../lib Cisco Config Sharefunc.pm $ ls ../lib/Config General General.pm
thanks!

Replies are listed 'Best First'.
Re: Strange problem when I install CPAN module to my own directory
by chromatic (Archbishop) on Apr 16, 2004 at 03:17 UTC

    The current working directory of a program executed by your web server is probably not what you expect. You may need an absolute path in your use lib line. You can use Cwd to figure out the current working directory of your script in both environments.

      thanks for your reply,but I think that is not the reason.I modified the directory to absolute directory.And the error is same.

      $ more config #!/usr/bin/perl use lib '/data/zht/perl/lib'; use Config::General; print "Content-type: text/html\n\n"; print "ok"; $ ls /data/zht/perl/lib Cisco Config Sharefunc.pm $ ls /data/zht/perl/lib/Config General General.pm
      thanks!
        What about permissions? See CGI Help Guide.

        MJD says "you can't just make shit up and expect the computer to know what you mean, retardo!"
        I run a Win32 PPM repository for perl 5.6.x and 5.8.x -- I take requests (README).
        ** The third rule of perl club is a statement of fact: pod is sexy.

Re: Strange problem when I install CPAN module to my own directory
by iwanthome (Beadle) on Apr 16, 2004 at 08:17 UTC

    To PodMaster

    thanks! The problem is solved by modify permissions!

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://345607]
Approved by bart
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others meditating upon the Monastery: (7)
As of 2024-04-19 11:46 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found