I'm trying to edit a perl forum for a friends' company, but before I can do that, I need to get it working on my local server. I'm on winXP running Apache 1.3.27, and the newest version of perl. my CGI scripts work perfectly on my server, when I write them. However, my friend sent me this script, which works fine on his server, but I can't get it to run on mine.
For example, I tried to run cp.cgi, which would configure the script for my server. But when I run it, I get:
Software error:
Can't find string terminator "END" anywhere before EOF at c:\PROGRA~1\APACHE~1\apache\cgi-bin\cp.cgi line 109.
Here is that piece of code:
[tt]
106 } elsif ($in{ubb} eq 'set_initial') {
107 &SetInitial;
108 } else {
109 print<<END;
110 Content-type: text/plain
111
112 Sorry, I can't process ubb=$in{ubb} during an initial setup. Please try again without it.
113 END
114 } # end if
115 exit(0);
116 } # end unless
[/tt]
it looks fine to me, and works in some of my other scripts.
However, if I change it so that it is:
[tt]
print "Content-type: text/plain\n\n";
print "Sorry, I can't process ubb=$in{ubb} during an initial setup. Please try again without it.\n";
[/tt]
it seems to work, or at least it gives me a different error. like:
Software error:
Can't find string terminator "TheENV" anywhere before EOF at ubb_setup.cgi line 107.
Software error:
[Sat Jan 4 01:30:07 2003] c:\PROGRA~1\APACHE~1\apache\cgi-bin\cp.cgi: Can't find string terminator "TheENV" anywhere before EOF at ubb_setup.cgi line 107. Compilation failed in require at c:\PROGRA~1\APACHE~1\apache\cgi-bin\cp.cgi line 101.
obviously, cp.cgi calls ubb_setup.cgi, so I open that file, and find these lines, which also look fine to me:
[tt]
104 -type => "text/html",
105 );
106
107 print <<TheENV;
108 <html><head><title>UBB.classic: Your Environmental Variables</title></head>
109 <body bgcolor="#FFFFFF">
110 <font size="2" face="Verdana, Arial">
111 <b>Your Environmental Variables</b>
112 <p>
113 Use this information to help you figure out your absolute file paths, and
114 other system information.
115 </p><p>
116 <b>Perl Info:</b><br />
117 You are using <b>Perl Version $]</b>
118 </p><p>
119 <b>Your Environmental Variables:</b>
120 <br />
121 <font size="1">
122 Note: "DOCUMENT_ROOT" shows your absolute path to your root web directory.
123 "SCRIPT_FILENAME" shows you absolute path of your CGI directory.
124 If your SCRIPT_FILENAME shows "/125 your Absolute Path variable for your CGI directory would be
126 "/ On some servers this value is
127 called PATH_TRANSLATED.</font>
128 </p>
129 </font><pre>
130 TheENV
131
132 foreach(sort {$a cmp $b} keys %ENV) {
133 printf("<b>%-25s</b>%s\n", "$_:", UBBCGI::escapeHTML($ENV{$_}));
[/tt]
and so I can fix it by changing each line to it's own print statment.. but that takes a fair amount of time. becuase when I run it again, I get ANOTHER error, and ANOTHER AND ANOTHER... and it seems like an endless amount of fixing those stupid print <<FILEHANDLE; errors. I've tried changing them. usually when I code, I leave them right against the left side, and use quotation marks:
print <<"FILEHANDLE";
blah blah blah
FILEHANDLE
but it still doesn't work for this script. ANY ideas? or do I just take the time one day to change it so it prints each line individually? I'd still like to know why it doesn't work though, when it works on his server
For example, I tried to run cp.cgi, which would configure the script for my server. But when I run it, I get:
Software error:
Can't find string terminator "END" anywhere before EOF at c:\PROGRA~1\APACHE~1\apache\cgi-bin\cp.cgi line 109.
Here is that piece of code:
[tt]
106 } elsif ($in{ubb} eq 'set_initial') {
107 &SetInitial;
108 } else {
109 print<<END;
110 Content-type: text/plain
111
112 Sorry, I can't process ubb=$in{ubb} during an initial setup. Please try again without it.
113 END
114 } # end if
115 exit(0);
116 } # end unless
[/tt]
it looks fine to me, and works in some of my other scripts.
However, if I change it so that it is:
[tt]
print "Content-type: text/plain\n\n";
print "Sorry, I can't process ubb=$in{ubb} during an initial setup. Please try again without it.\n";
[/tt]
it seems to work, or at least it gives me a different error. like:
Software error:
Can't find string terminator "TheENV" anywhere before EOF at ubb_setup.cgi line 107.
Software error:
[Sat Jan 4 01:30:07 2003] c:\PROGRA~1\APACHE~1\apache\cgi-bin\cp.cgi: Can't find string terminator "TheENV" anywhere before EOF at ubb_setup.cgi line 107. Compilation failed in require at c:\PROGRA~1\APACHE~1\apache\cgi-bin\cp.cgi line 101.
obviously, cp.cgi calls ubb_setup.cgi, so I open that file, and find these lines, which also look fine to me:
[tt]
104 -type => "text/html",
105 );
106
107 print <<TheENV;
108 <html><head><title>UBB.classic: Your Environmental Variables</title></head>
109 <body bgcolor="#FFFFFF">
110 <font size="2" face="Verdana, Arial">
111 <b>Your Environmental Variables</b>
112 <p>
113 Use this information to help you figure out your absolute file paths, and
114 other system information.
115 </p><p>
116 <b>Perl Info:</b><br />
117 You are using <b>Perl Version $]</b>
118 </p><p>
119 <b>Your Environmental Variables:</b>
120 <br />
121 <font size="1">
122 Note: "DOCUMENT_ROOT" shows your absolute path to your root web directory.
123 "SCRIPT_FILENAME" shows you absolute path of your CGI directory.
124 If your SCRIPT_FILENAME shows "/125 your Absolute Path variable for your CGI directory would be
126 "/ On some servers this value is
127 called PATH_TRANSLATED.</font>
128 </p>
129 </font><pre>
130 TheENV
131
132 foreach(sort {$a cmp $b} keys %ENV) {
133 printf("<b>%-25s</b>%s\n", "$_:", UBBCGI::escapeHTML($ENV{$_}));
[/tt]
and so I can fix it by changing each line to it's own print statment.. but that takes a fair amount of time. becuase when I run it again, I get ANOTHER error, and ANOTHER AND ANOTHER... and it seems like an endless amount of fixing those stupid print <<FILEHANDLE; errors. I've tried changing them. usually when I code, I leave them right against the left side, and use quotation marks:
print <<"FILEHANDLE";
blah blah blah
FILEHANDLE
but it still doesn't work for this script. ANY ideas? or do I just take the time one day to change it so it prints each line individually? I'd still like to know why it doesn't work though, when it works on his server