Tom Phoenix rb-pdx-pm at
Wed Aug 15 17:20:23 CDT 2001

On Tue, 14 Aug 2001, Kari Chisholm wrote:

> So, in each of those two cgi's I've got this line
> 	require ("/www/karic/mystuff/global.cgi");
> I can't find any documentation that says I can crawl around my file server like
> this using require, but nothing that says I can't either.

You should be able to do this, since you're using an absolute path. Of
course, as someone else pointed out, your global.cgi file has to be
readable by the webserver, and it has to return a true value
(traditionally, by using "1" as its last line).

> Nonetheless, I'm getting a server error.  

There are other ways to do this, but for debugging, I
sometimes put something like this near the top of a script.

    # Remove this block when done debugging!
    BEGIN {
	local($|) = 1;			# Temporarily turn off buffering
	print "Content-type: text/plain\n\n";
	my $date = localtime;
	print "Script $0\nrunning on $date (Perl version $])\n\n";
	unless (open STDERR, ">&STDOUT") {
	    print "Can't redirect STDERR: $!";
	print "\n";

Now you should be able to see any error messages (and everything else)
produced by your script, right on your browser.

Hope this helps!

Tom Phoenix       Perl Training and Hacking       Esperanto
Randal Schwartz Case:


More information about the Pdx-pm-list mailing list