v2.21 release
[perl/plp/.git] / plpfields.pm
1 #!/usr/bin/perl
2 # shebang only for color coding, just ignore it m'kay?
3 use strict;
4 use vars qw(%get %post %fields %cookie %INTERNAL);
5
6 if ($ENV{QUERY_STRING} ne ''){
7     for (split /&/, $ENV{QUERY_STRING}) {
8         my @keyval = split /=/;
9         DecodeURI(@keyval);
10         $get{$keyval[0]} = $keyval[1];
11     }
12 }
13
14
15 $INTERNAL{post} = <STDIN>;
16 if ($INTERNAL{post} ne ''){
17     for (split /&/, $INTERNAL{post}) {
18         my @keyval = split /=/;
19         DecodeURI(@keyval);
20         $post{$keyval[0]} = $keyval[1];
21     }
22 }
23
24 %fields = %get;
25 @fields{keys %post} = values %post;
26 #%fields = (%get, %post);
27
28 if ($ENV{HTTP_COOKIE} ne ''){
29     for (split /; ?/, $ENV{HTTP_COOKIE}) {
30         my @keyval = split /=/;
31         $cookie{$keyval[0]} ||= $keyval[1];
32     }
33 }
34
35 1;