[Date Prev][Date Next][Thread Prev][Thread Next] [Search] [Date Index] [Thread Index]

Re: [MacPerl] Is there a problem with MacPerl's CGI extensionfile?



At 2:29 PM -0400 7/3/98, Stˇphane Jose mentioned:
>The version of MacPerl is 5.2.0r4, CGI.pm is the one included with the
>release.
>I have allocated Mac Perl and WebStar about 12MB of RAM each.
>
>Is there be a problem with MacPerl's CGI extension file that I am not
>aware of?

Stˇphane,

Try upgrading to the newest version of CGI.pm (v2.42).  The Mac version is
available from the CGI.pm home page:
http://www.genome.wi.mit.edu/ftp/pub/software/WWW/cgi_docs.html

NOTE: Even though it's a Mac version, you'll still need to change the files
from UNIX End of Lines to Mac EOLs.

I haven't had trouble making it work as a cgi applet.  There are a few
problems between the current versions of MacPERL and CGI.pm, however:

1) File uploads do not work.
2) MacPerl 5.2.0r4 seems to mangle the HTTP_REFERER and the Content-type
string... here's some code that you can insert at the top of the CGI.pm
routine 'init' to compensate:

# This code compensates for MacPerl's mangling of
# HTTP_REFERER and Content-type
# MRL
#
#foreach ('SERVER_SOFTWARE', 'HTTP_REFERER',
#         'HTTP_USER_AGENT', 'CONTENT_TYPE') {  # Show all the %ENV variables
#     print "$_ = $ENV{$_}<br>";
#}
#foreach (keys %ENV) {                          # Show a few variables
#     print "$_ = $ENV{$_}<br>";
#}
#print "<p>Extracting...<br>";

if (defined($ENV{'HTTP_REFERER'})) {
	my (@referer) = split(/$CGI::CRLF/, $ENV{'HTTP_REFERER'});
	foreach ( @referer ) {
		($ENV{'CONTENT_TYPE'}) = /: (.*)/ if /Content-type/;
#		print "$_<br>";
	}
	$ENV{'HTTP_REFERER'} = $referer[0];
}

#print "<p>After Extraction...<br>";
#foreach ('HTTP_REFERER', 'CONTENT_TYPE') {      # Confirm the repairs
#    print "$_ = $ENV{$_}<br>" if defined($ENV{$_});
#}

Good luck,
--Michael



Michael Leahy, Computer Systems Engineer  michael.leahy@vt.edu
Educational Technologies, Mail Code 0232
Old Security Building, Virginia Tech              540-231-3272
Blacksburg, Virginia  24061                  fax  540-231-5922

         Intellectual revolutions succeed when
         the old guard dies or retires. --Unknown



***** Want to unsubscribe from this list?
***** Send mail with body "unsubscribe" to mac-perl-request@iis.ee.ethz.ch