Re: [PATCH] use CGI.pm;

From: Matthew Wickline (listbox@wickline.org)
Date: Wed, Sep 29 1999


Date: Wed, 29 Sep 1999 06:02:43 -0500
From: Matthew Wickline <listbox@wickline.org>
To: Gerald Oskoboiny <gerald@w3.org>
Cc: Terje Bless <link@tss.no>, W3C Validator <www-validator@w3.org>
Message-id: <01JGJ66D568299DHFE@kids.wustl.edu>
Subject: 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