--- perl/kanzan/kanzan.cgi 2002/09/04 09:02:38 1.4 +++ perl/kanzan/kanzan.cgi 2003/11/05 12:52:46 1.5 @@ -1,7 +1,10 @@ -#!/usr/local/bin/perl +#!/usr/bin/perl use strict; -require Suika::CGI; + +for (split /[&;]/, $main::ENV{QUERY_STRING}) { + +} my %ex_point1 = (); ( @@ -89,6 +92,7 @@ ($percent, $object_percent, \%kanzaned1, \%kanzaned2); } +%Suika::CGI::param = %{__get_parameter ()}; my (%mypoint1, %mypoint2, %haiten1, %haiten2); if ($Suika::CGI::param{newform} ne 'no') { %mypoint1 = %ex_point1; @@ -142,15 +146,17 @@ 配点換算 - + -

配点換算

-
+ @@ -263,16 +269,48 @@ EOH } +sub __get_parameter () { + my @src; + + ## Query-string of Request-URI + my $qs = $main::ENV{QUERY_STRING}; + push @src, $qs if (index ($qs, '=') > -1); + + ## Entity-body + if ($main::ENV{REQUEST_METHOD} eq 'POST') { + my $mt = $main::ENV{CONTENT_TYPE}; + if ($mt =~ m<^application/(?:x-www|sgml)-form-urlencoded\b>) { + my $body; + read STDIN, $body, $main::ENV{CONTENT_LENGTH}; + push @src, $body; + } + } + + my %temp_params; + for my $src (@src) { + for (split /[;&]/, $src) { + my ($name, $val) = split '=', $_, 2; + for ($name, $val) { + tr/+/ /; + s/%([0-9A-Fa-f][0-9A-Fa-f])/pack 'C', hex $1/ge; + } + $temp_params{$name} = $val; + } + } + \%temp_params; +} + + =head1 LICENSE -Copyright 2001-2002 wakaba Ew@suika.fam.cxE. +Copyright 2001-2003 Wakaba Ew@suika.fam.cxE. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -291,5 +329,5 @@ =cut -1; # $Date: 2002/09/04 09:02:38 $ -### kanzan.cgi ends here +1; # $Date: 2003/11/05 12:52:46 $ +