Re: [PATCH] use CGI.pm;

gerald@w3.org, 1999_09_28:
> It wants '=' after the parameters


I haven't tested this code, so pardon typos :) What if you
pre-process the query string before cgi.pm gets called?
Kinda like:

    BEGIN {
        $ENV{QUERY_STRING}
            =~ s/(^|\G)([^;&]+)([;&]|$)/$2=$3/g;
    }
    use CGI qw(:cgi -newstyle_urls -private_tempfiles);

Above won't work for POSTs. Does anyone use POST to call
the validator? I suppose that sort of strategy could be
finessed to work with POSTS as well, if necessary. Just
pre-process any post request until it looks like a 
(properly munged) GET request by the time it gets to
cgi.pm

If that works, perhaps that old funky style of passing
parameters in the PATH_INFO could be supported by changing
the above BEGIN block to something like:

    BEGIN {
        if (
            length( $ENV{PATH_INFO} )
            and not
            length( $ENV{QUERY_STRING} )
        ) {
            ( $ENV{QUERY_STRING} = $ENV{PATH_INFO} )
                =~ s|/|;|g
        }
        $ENV{QUERY_STRING}
            =~ s/(?<=^|[;&])([^;&]+)([;&]|$)/$1=$2/g;
    }

-matt

Received on Wednesday, 29 September 1999 07:02:53 UTC