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

Hi All, I'm unable to get my locally installed HTTP modules to interface with each other. Apologies in advance for the heaps of code below - I tried to organize it as best as possible.

Here's the path to the modules...

/path/to/the/cgi/bin/cgi-bin/usr/local/lib/perl5/site_perl/HTTP> ls -l -r--r--r-- 1 mhalunen user 19433 Dec 8 2004 Message.pm -r--r--r-- 1 mhalunen user 5030 Apr 7 2004 Request.pm -r--r--r-- 1 mhalunen user 11827 Dec 11 2004 Response.pm
Here's the program snippet...
use lib qw(/path/to/the/cgi/bin/cgi-bin/usr/local /path/to/the/cgi/bin/cgi-bin/usr/local/lib/perl5 /path/to/the/cgi/bin/cgi-bin/usr/local/bin /path/to/the/cgi/bin/cgi-bin/usr/local/lib/perl5/site_perl /path/to/the/cgi/bin/cgi-bin/usr/local/bin /path/to/the/cgi/bin/cgi-bin/usr/local/lib/perl5/man /path/to/the/cgi/bin/cgi-bin/usr/local/lib/perl5/man/man3); use XML::Filter::ExceptionLocator; # <-- locally installed use HTTP::Request; # <-- locally installed (Invokin +g this module triggers the server error)
Here's the error...
...got line "compilation failed in require at /path/to/the/cgi/bin/cgi +-bin/usr/local/lib/perl5/site_perl/http/request.pm line 5.")
line 5 from request.pm is:
require HTTP::Message;
It appears to me that HTTP::Request is not interfacing with HTTP::Message. Any thoughts?

Replies are listed 'Best First'.
Re: locally installed modules not interfacing
by japhy (Canon) on Sep 22, 2005 at 14:41 UTC
    Are the files in the proper case? Your error message shows 'http/request.pm' where it should be 'HTTP/Request.pm'.

    Jeff japhy Pinyan, P.L., P.M., P.O.D, X.S.: Perl, regex, and perl hacker
    How can we ever be the sold short or the cheated, we who for every service have long ago been overpaid? ~~ Meister Eckhart
      The modules are named just as they were installed from CPAN. I'm not sure why the error message is displaying both the 'HTTP' directory and module name in lowercase. This is an interesting question.
Re: locally installed modules not interfacing
by philcrow (Priest) on Sep 22, 2005 at 15:03 UTC
    Does the required file correctly compile? Try perl -c Request.pm. Then do the same for the HTTP::Message. If it complains about not being able to find something add a -I /path/to/what/it/could/not/find/lib.

    Phil

      Phil Both Request.pm and Message.pm are compiling fine. Good suggestion though. Mike
Re: locally installed modules not interfacing
by randyk (Parson) on Sep 22, 2005 at 22:49 UTC
    Is the listing you provided for the local HTTP subdirectory:
    /path/to/the/cgi/bin/cgi-bin/usr/local/lib/perl5/site_perl/HTTP> ls -l -r--r--r-- 1 mhalunen user 19433 Dec 8 2004 Message.pm -r--r--r-- 1 mhalunen user 5030 Apr 7 2004 Request.pm -r--r--r-- 1 mhalunen user 11827 Dec 11 2004 Response.pm
    a complete one? The HTTP::* modules provided by libwww-perl indicates that there's more; in particular, HTTP::Headers is present, which is required by HTTP::Message, but is missing in your listing above - is it available elsewhere?. HTTP::Message also may require other modules, such as URI, HTTP::Headers::Util, Compress::Zlib, and others, depending on the context - are these available within the set of directories specified in your use lib statement?
      Hi randyk, I abbreviated the listing. Here's the full file list:
      drwxr-xr-x 2 mhalunen user 4096 Sep 20 17:56 Cookies -rwxrwxrwx 1 mhalunen user 20549 Nov 12 2004 Cookies.pm -rwxrwxrwx 1 mhalunen user 22179 Dec 11 2004 Daemon.pm -rwxrwxrwx 1 mhalunen user 10744 Oct 23 2003 Date.pm -rw-rw-r-- 1 mhalunen user 0 Sep 23 08:48 docs.txt drwxr-xr-x 2 mhalunen user 4096 Sep 20 17:56 Headers -rwxrwxrwx 1 mhalunen user 21243 Nov 12 2004 Headers.pm -rwxrwxrwx 1 mhalunen user 19433 Sep 22 16:35 Message.pm -rwxrwxrwx 1 mhalunen user 16242 Apr 9 2004 Negotiate.pm -rw-rw-r-- 1 mhalunen user 78 Sep 22 12:31 pwd.txt drwxr-xr-x 2 mhalunen user 4096 Sep 20 17:56 Request -rwxrwxrwx 1 mhalunen user 5030 Apr 7 2004 Request.pm -rwxrwxrwx 1 mhalunen user 11827 Sep 22 16:35 Response.pm -rwxrwxrwx 1 mhalunen user 6653 Oct 23 2003 Status.pm
      Normally the file permissions are '-r--r--r--'. I changed them for testing.
Re: locally installed modules not interfacing
by randyk (Parson) on Sep 22, 2005 at 19:20 UTC
    Does the user/group that the web server (or whoever is invoking the script) is running under have the proper permissions to read the files under /path/to/the/cgi/bin/cgi-bin/?
      I assume that permissions are OK. When I comment out the HTTP::Request module, the CGI works fine. Other locally installed modules referenced by the CGI are not complaining when the script runs. Good Question.
      Hi Randy - I think that you are on the right track. I set up a test script that calls this module. When I execute the script from the command line, it executes fine. But when I run the script as a web page, it fails. I think I have it narrowed down. Thanks again for your help.
Re: locally installed modules not interfacing
by radiantmatrix (Parson) on Sep 22, 2005 at 19:30 UTC

    Is it possible that HTTP::Request is not aware, at compile time, of the library search path you've created with 'use lib'?

    <-radiant.matrix->
    Larry Wall is Yoda: there is no try{} (ok, except in Perl6; way to ruin a joke, Larry! ;P)
    The Code that can be seen is not the true Code
    "In any sufficiently large group of people, most are idiots" - Kaa's Law
      I think you are asking the right questions. Yes....I think that this is possible. I have tried to address this concern by replacing 'HTTP::Request' in Message.pm with 'require "/absolue/path/to/HTTP/Request.pm";' but I get the same error.

        I think you're missing the point. HTTP::Request require's other modules. But, HTTP::Request may not be aware of your modified @INC (which you create with use lib). How can HTTP::Request load those if it doesn't know where to find them?

        I don't know if this is the issue, perhaps a more knowledgeable monk can help.

        <-radiant.matrix->
        Larry Wall is Yoda: there is no try{} (ok, except in Perl6; way to ruin a joke, Larry! ;P)
        The Code that can be seen is not the true Code
        "In any sufficiently large group of people, most are idiots" - Kaa's Law