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

I have installed the CGI::FormBuilder module successfully.   However, when I try to run the cgi script on the system, I get the following error:
Software error: Can't locate CGI/FormBuilder.pm in @INC ( @INC contains: /usr/local/lib/perl5/5.8.0/sun4-solaris /usr/local/lib/perl5/5.8.0 /usr/local/lib/perl5/site_perl/5.8.0/sun4-solaris /usr/local/lib/perl5/site_perl/5.8.0 /usr/local/lib/perl5/site_perl ) at /www/cgi-bin/test.cgi line 4. BEGIN failed--compilation aborted at /www/cgi-bin/test.cgi line 4.
I tested the script from the command line and it runs with no errors.   I have not been able to figure out why it doesn't work.

Thanks!!

janitored by ybiC: Balanced <code> tags around error message and other minor format tweaks for legibility, rename from "CGI::FormBuilder" to aid searching

Replies are listed 'Best First'.
Re: CGI::FormBuilder, @INC, sun4-solaris
by sschneid (Deacon) on Jan 05, 2004 at 17:26 UTC
    Where have you put the CGI::FormBuilder modules? It seems like your @INC cannot find them; an easy fix is to modify your script to include the location. For instance, if your modules are in /home/username/lib, add the following to the top of your script:
    BEGIN { unshift @INC, '/home/username/lib' }
    -s.
      I added the statement to the script as you suggested and also conducted a search to verify the location of FormBuilder.pm
      /usr/local/lib/perl5/site_perl/5.8.0/CGI/FormBuilder.pm /usr/local/lib/perl5/site_perl/5.8.0/FormBuilder.pm /usr/local/lib/perl5/FormBuilder.pm

      I still get the following error after running the script:

      Software error: Can't locate CGI/FormBuilder.pm in @INC (@INC contains: /usr/local/lib/perl5/site_perl/5.8.0/CGI/ /usr/local/lib/perl5/5.8.0/sun4-solaris /usr/local/lib/perl5/5.8.0 /usr/local/lib/perl5/site_perl/5.8.0/sun4-solaris /usr/local/lib/perl5/site_perl/5.8.0 /usr/local/lib/perl5/site_perl ) at /www/cgi-bin/test.cgi line 6 BEGIN failed--compilation aborted at /www/cgi-bin/test.cgi line 6.

      janitored by ybiC: Balanced <code> tags around error message and other minor format tweaks for legibility

Re: CGI::FormBuilder, @INC, sun4-solaris
by jdtoronto (Prior) on Jan 05, 2004 at 17:39 UTC
    From the command line issue the command 'perl -V' and look to see exactly what the @INC contains. Then go and check just where the module is! Your web server environment may not be able to see the directory it was installed in, or permissions may not be set correctly.

    The fact that it can be found by a command line script running presumably under the user-name that installed the module would seem to indicate permissions to me (or at least that is what usually catches me!).

    jdtoronto