
sub init_form {
	local(@assocarray, $assoc, $property, $value, $method);
	
	$method = exists $ENV{'REQUEST_METHOD'} || '';
	$method =~ tr/A-Z/a-z/;
	if ($method eq 'post') {
		read(STDIN, $query, $ENV{'CONTENT_LENGTH'} || '');
    } else {
		$query = $ENV{'QUERY_STRING'} || '';
    }
    @assocarray = split(/&/, $query);
    foreach $assoc (@assocarray) {
		($property, $value) = split(/=/, $assoc);
		$value =~ tr/+/ /;
		$value =~ s/%([A-Fa-f0-9][A-Fa-f0-9])/pack("C", hex($1))/eg;
		$form{$property} = $value;
	}
}

1;