Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

require function errors 1

Status
Not open for further replies.

blitzer

Programmer
Jun 18, 2001
34
CA
when i use require "myfile.cgi" in a perl file with a parser i always get errors.. the script cant handle requireing myfile.cgi if myfile uses the open function.. it's fine when myfile.cgi is just variables but when there are functions in it there's trouble.. any explanations?
 
Does the required file open files using relative directories? Maybe the required code is considered part of the main script and thus is looking for the file in the wrong directory, and dying.
 
krel: nah, the files are definately opening because it only crashes when it opens certain ones.. and if i change the content of the file it will work.

-dan
 
Perhaps its time to see these error messages that you mentioned.

jaa
 
justice: It's just a simple 500 internal server error.. the required file is just a bunch of variables.. looks something like this:

open(PAGE,"$the_page_file");
@PAGE = <PAGE>;
close(PAGE);

$blah = blah;
$blah2 = blah2;

Now, when I remove the open part it works fine.. problem is that the variables depend on what's in the $the_page_file..
 
I would suggest that you run the script from the command line if you can, this might give you more enligtening errror messages.

Another option is to add
Code:
use CGI::Carp qw(fatalsToBrowser);
to the top of the main scripit. This will spit out any error messages generated by your script to your browser. Can be very helpful for certain errors.

jaa
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top