Bug 2845 - Perl cgi-bin bug
Summary: Perl cgi-bin bug
Alias: None
Product: Red Hat Linux
Classification: Retired
Component: perl
Version: 5.2
Hardware: i386
OS: Linux
Target Milestone: ---
Assignee: Crutcher Dunnavant
QA Contact:
Depends On:
TreeView+ depends on / blocked
Reported: 1999-05-15 21:15 UTC by aftab
Modified: 2008-05-01 15:37 UTC (History)
1 user (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Last Closed: 1999-08-30 02:33:54 UTC

Attachments (Terms of Use)

Description aftab 1999-05-15 21:15:04 UTC
I have recently installed Redhat Linux, and when I copied
my web page from my PC to linux, it did not execute the
scripts properly. I have also updated my perl version with
the latest update on you web site (14/05/99)and still had
the same problem. After some debugging I have found what
the problem is: I pass a reference to an associate array to
a subroutine. This subroutine then fills in this array. But
the items this subroutine enters into the array are not
visable outside this array as they should be as I passed
the array by reference. These scripts have been working on
my PC and on ISP unix machine. The contenets of the script
are below.



#the login_form is empty it does not get filled as it should

$userid = $login_form{'userid'};
$pass = $login_form{'pass'};

#the subroutine
sub parse_input {
	if (defined(@_)) {
	else {
	local ($temp,@pairs);
	if (&form_method eq 'POST') {
	else {
	if ($temp ne '') {
		foreach $item(@pairs) {
			($key,$content)=split (/=/,$item,2);
			$content=~tr/+/ /;
			$content=~ s/%(..)/pack("c",hex
			if (!defined($input{$key})) {
			else {
				$input{$key} .= "\0
		return 1;
	else {
		return 0;

Comment 1 Cristian Gafton 1999-08-30 02:33:59 UTC
You can change the perl fucntion to return the actual array instead
of 	playing the by-refreence game, whcih is totally evil. At a first
fast glance I got scaried by things like
	$input{$key} .= "\0$content";
I'd suggest you rather use the CGI module if you want to parse this
kind of free form variables.

Note You need to log in before you can comment on or make changes to this bug.