in reply to problem with require lib file

Okay ... I know others will say this too - but cgi-lib.pl is evil incarnate and replacing this CGI will not only save your soul, but also mean that you will no longer have issues with require in your code.

Why is cgi-lib.pl so evil? Have a look at use CGI or die;

As onto your specific problem with cgi-lib.pl - What errors are being returned? What is showing up in your server log when you try and run your CGI script? Is it possible that you have not set the right path or permissions for your code? Have a look at the CGI Help Guide by tachyon which provides some excellent directions for CGI code debugging.

 

perl -e 's&&rob@cowsnet.com.au&&&split/[@.]/&&s&.com.&_&&&print'

Replies are listed 'Best First'.
Re: problem with require lib file
by Spenser (Friar) on Dec 12, 2001 at 08:38 UTC

    I'm still pretty new to Perl myself, so I can't elaborate like some of the others.  However, I have noticed that when setting up a *.lib file, the last line containing text of the lib file must read simply as follows:

    1;

    I don't know why that simple arabic numeral one with a semi-colon is necessary, but it is.  Again, there are those that will probably follow my comment with an explanation.  Actually, I would be interested to hear their response to this element.

      Library module files are supposed to return a true value. Having a one at the end accomplishes this. I don't recall the exact reason but I think it's because, underneath all of the fancy importing and namespace magic that 'use' does, there's a 'do FILE' deep down, and it returns the last value evaluated in a file, and you will always want that to be true.

      -- Brett

      Go not to the Elves for counsel, for they will say both no and yes