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

I have a few different questions that I hope someone can clear up.

An error I am getting from one of my scripts is "/home/everyday/public_html/upload.cgi did not return a true value at /home/everyday/public_html/index.cgi line 66.". Which of the two files should I be looking at to find where the bug is?

Question 2: both the files as seen in the error above require() files at the top of the scripts. When the script says upload.cgi did not return a true value, is it just upload.cgi that errored out or could it be the require("header.cgi"); that's at the top of the script? And when doing line counts in upload.cgi for line 66, is it 66 lines in that file or do I have to count 1 - (first req. file line), count all those lines, then go back to my upload.cgi? I have no idea what line could be wrong because it's requiring() a file.

Last but not least, the following snippet dies

if (!defined($index_page)) { require("header.cgi"); $main_content = $ENV{"DOCUMENT_ROOT"} . "/upload.cgi"; #print "test"; print $index_page; require($index_page); exit; }
The error is "Compilation failed in require at upload.cgi line 15.". I included a test print statement fir $index_page (which is the one that's failing) and it's printing "home/everyday/public_html/index.cgi" and that file does exist and it works!. So what could be the problem?

Thanks for your help everyone.

Replies are listed 'Best First'.
Re: Require files
by Zaxo (Archbishop) on Jan 10, 2005 at 07:27 UTC

    I suspect that header.cgi is 66 lines long. Perl require demands that the file it loads return a true value to signify success. Try appending this to the end of header.cgi: 1; and see if that doesn't fix the problem.

    After Compline,
    Zaxo

      Okay, I added 1; to the last line of all the files I'm requiring and it didn't change. The compilation error is still present.

      Any other suggestions?

      Thanks!

        It doesn't seem likely, but do you have a return; or return 0; statement somewhere outside a sub definition in the required file?

        It would help save wear and tear on my guesser if you showed us the file. Particularly, line 66 and prior.

        After Compline,
        Zaxo

Re: Require files
by geektron (Curate) on Jan 10, 2005 at 07:28 UTC
    any included modules ( via require or use need to return a true value. normally, this is achieved by ending a module with:
    ## penultimate line 1;
    so i would check header.cgi to see if it returns that value.

    the same applies to all other required code.