Skip Menu |

Preferred bug tracker

Please visit the preferred bug tracker to report your issue.

This queue is for tickets about the CGI CPAN distribution.

Report information
The Basics
Id: 36158
Status: resolved
Priority: 0/
Queue: CGI

People
Owner: Nobody in particular
Requestors: cberry [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: Important
Broken in: (no value)
Fixed in: (no value)



Subject: [PATCH] portability tweaks for upload tests
The attached patch makes the setup of %ENV in upload.t and uploadInfo.t work on VMS. There is nothing VMS-specific about my changes so they should work everywhere. Without this I get: $ perl [-.lib.cgi.t]uploadinfo.t Can't make list assignment to %ENV on this system at [-.lib.cgi.t]uploadinfo.t line 32. # Looks like your test died before it could output anything. The patch also removes the entries from %ENV in an END block. Without this, on VMS the changes to the environment persist and are visible after Perl exits. This patch is against blead but I think things are currently in synch enough that you should be able to apply it with patch -p2.
Subject: env_setup.patch.txt
--- lib/CGI/t/uploadInfo.t;-0 Fri Mar 28 14:19:53 2008 +++ lib/CGI/t/uploadInfo.t Sat May 24 11:25:08 2008 @@ -29,32 +29,46 @@ use CGI; # %ENV setup. #----------------------------------------------------------------------------- -%ENV = ( - %ENV, - 'SCRIPT_NAME' => '/test.cgi', - 'SERVER_NAME' => 'perl.org', - 'HTTP_CONNECTION' => 'TE, close', - 'REQUEST_METHOD' => 'POST', - 'SCRIPT_URI' => 'http://www.perl.org/test.cgi', - 'CONTENT_LENGTH' => 3285, - 'SCRIPT_FILENAME' => '/home/usr/test.cgi', - 'SERVER_SOFTWARE' => 'Apache/1.3.27 (Unix) ', - 'HTTP_TE' => 'deflate,gzip;q=0.3', - 'QUERY_STRING' => '', - 'REMOTE_PORT' => '1855', - 'HTTP_USER_AGENT' => 'Mozilla/5.0 (compatible; Konqueror/2.1.1; X11)', - 'SERVER_PORT' => '80', - 'REMOTE_ADDR' => '127.0.0.1', - 'CONTENT_TYPE' => 'multipart/form-data; boundary=xYzZY', - 'SERVER_PROTOCOL' => 'HTTP/1.1', - 'PATH' => '/usr/local/bin:/usr/bin:/bin', - 'REQUEST_URI' => '/test.cgi', - 'GATEWAY_INTERFACE' => 'CGI/1.1', - 'SCRIPT_URL' => '/test.cgi', - 'SERVER_ADDR' => '127.0.0.1', - 'DOCUMENT_ROOT' => '/home/develop', - 'HTTP_HOST' => 'www.perl.org' -); +my %myenv; + +BEGIN { + %myenv = ( + 'SCRIPT_NAME' => '/test.cgi', + 'SERVER_NAME' => 'perl.org', + 'HTTP_CONNECTION' => 'TE, close', + 'REQUEST_METHOD' => 'POST', + 'SCRIPT_URI' => 'http://www.perl.org/test.cgi', + 'CONTENT_LENGTH' => 3285, + 'SCRIPT_FILENAME' => '/home/usr/test.cgi', + 'SERVER_SOFTWARE' => 'Apache/1.3.27 (Unix) ', + 'HTTP_TE' => 'deflate,gzip;q=0.3', + 'QUERY_STRING' => '', + 'REMOTE_PORT' => '1855', + 'HTTP_USER_AGENT' => 'Mozilla/5.0 (compatible; Konqueror/2.1.1; X11)', + 'SERVER_PORT' => '80', + 'REMOTE_ADDR' => '127.0.0.1', + 'CONTENT_TYPE' => 'multipart/form-data; boundary=xYzZY', + 'SERVER_PROTOCOL' => 'HTTP/1.1', + 'PATH' => '/usr/local/bin:/usr/bin:/bin', + 'REQUEST_URI' => '/test.cgi', + 'GATEWAY_INTERFACE' => 'CGI/1.1', + 'SCRIPT_URL' => '/test.cgi', + 'SERVER_ADDR' => '127.0.0.1', + 'DOCUMENT_ROOT' => '/home/develop', + 'HTTP_HOST' => 'www.perl.org' + ); + + for my $key (keys %myenv) { + $ENV{$key} = $myenv{$key}; + } +} + +END { + for my $key (keys %myenv) { + delete $ENV{$key}; + } +} + #----------------------------------------------------------------------------- # Simulate the upload (really, multiple uploads contained in a single stream). --- lib/CGI/t/upload.t;-0 Wed Apr 30 08:04:01 2008 +++ lib/CGI/t/upload.t Sat May 24 11:26:54 2008 @@ -29,32 +29,45 @@ use CGI; # %ENV setup. #----------------------------------------------------------------------------- -%ENV = ( - %ENV, - 'SCRIPT_NAME' => '/test.cgi', - 'SERVER_NAME' => 'perl.org', - 'HTTP_CONNECTION' => 'TE, close', - 'REQUEST_METHOD' => 'POST', - 'SCRIPT_URI' => 'http://www.perl.org/test.cgi', - 'CONTENT_LENGTH' => 3285, - 'SCRIPT_FILENAME' => '/home/usr/test.cgi', - 'SERVER_SOFTWARE' => 'Apache/1.3.27 (Unix) ', - 'HTTP_TE' => 'deflate,gzip;q=0.3', - 'QUERY_STRING' => '', - 'REMOTE_PORT' => '1855', - 'HTTP_USER_AGENT' => 'Mozilla/5.0 (compatible; Konqueror/2.1.1; X11)', - 'SERVER_PORT' => '80', - 'REMOTE_ADDR' => '127.0.0.1', - 'CONTENT_TYPE' => 'multipart/form-data; boundary=xYzZY', - 'SERVER_PROTOCOL' => 'HTTP/1.1', - 'PATH' => '/usr/local/bin:/usr/bin:/bin', - 'REQUEST_URI' => '/test.cgi', - 'GATEWAY_INTERFACE' => 'CGI/1.1', - 'SCRIPT_URL' => '/test.cgi', - 'SERVER_ADDR' => '127.0.0.1', - 'DOCUMENT_ROOT' => '/home/develop', - 'HTTP_HOST' => 'www.perl.org' -); +my %myenv; + +BEGIN { + %myenv = ( + 'SCRIPT_NAME' => '/test.cgi', + 'SERVER_NAME' => 'perl.org', + 'HTTP_CONNECTION' => 'TE, close', + 'REQUEST_METHOD' => 'POST', + 'SCRIPT_URI' => 'http://www.perl.org/test.cgi', + 'CONTENT_LENGTH' => 3285, + 'SCRIPT_FILENAME' => '/home/usr/test.cgi', + 'SERVER_SOFTWARE' => 'Apache/1.3.27 (Unix) ', + 'HTTP_TE' => 'deflate,gzip;q=0.3', + 'QUERY_STRING' => '', + 'REMOTE_PORT' => '1855', + 'HTTP_USER_AGENT' => 'Mozilla/5.0 (compatible; Konqueror/2.1.1; X11)', + 'SERVER_PORT' => '80', + 'REMOTE_ADDR' => '127.0.0.1', + 'CONTENT_TYPE' => 'multipart/form-data; boundary=xYzZY', + 'SERVER_PROTOCOL' => 'HTTP/1.1', + 'PATH' => '/usr/local/bin:/usr/bin:/bin', + 'REQUEST_URI' => '/test.cgi', + 'GATEWAY_INTERFACE' => 'CGI/1.1', + 'SCRIPT_URL' => '/test.cgi', + 'SERVER_ADDR' => '127.0.0.1', + 'DOCUMENT_ROOT' => '/home/develop', + 'HTTP_HOST' => 'www.perl.org' + ); + + for my $key (keys %myenv) { + $ENV{$key} = $myenv{$key}; + } +} + +END { + for my $key (keys %myenv) { + delete $ENV{$key}; + } +} #----------------------------------------------------------------------------- # Simulate the upload (really, multiple uploads contained in a single stream).
Ping. Any chance of getting this applied and into the next release? I see there have been two releases since I submitted it and without it I still see test failures in blead.
This patch will appear in version 3.42 as soon as regression tests pass. Currently a series of submitted patches have broken CGI.pm