• Home
  • History
  • Annotate
Name Date Size #Lines LOC

..03-May-2022-

lib/CGI/H16-Sep-2001-489164

t/H16-Sep-2001-2818

ChangesH A D16-Sep-20012.2 KiB5543

MANIFESTH A D18-Jul-2001112 98

Makefile.PLH A D18-Jul-2001342 107

READMEH A D18-Jul-20013.4 KiB10173

README

1NAME
2    CGI::Thin - A very lightweight Parser for CGI Forms
3
4SYNOPSIS
5    `use CGI::Thin;'
6
7    `my %cgi_data = &Parse_CGI ();'
8
9DESCRIPTION
10    This module is a very lightweight parser of CGI forms. And it
11    has a special feature that it will return an array if the same
12    key is used twice in the form. You can force an array even if
13    only one value returned to avoid complications.
14
15    The hash %cgi_data will have all the form data from either a
16    POST or GET form and will also work for "multipart/form-data"
17    forms necessary for uploading files.
18
19USAGE
20      Functions
21
22        * `CGI::Thin::Parse_CGI(@keys)'
23            The optional @keys will be used to force arrays to be returned.
24
25            The function also has special features for getting multiple values for a
26            single form key.  For example if we have this form...
27
28              <input type="checkbox" name="color" value="red">red
29              <input type="checkbox" name="color" value="green">green
30              <input type="checkbox" name="color" value="blue">blue
31
32            One of three things can happen.
33
34            1)  The user does not select any color.
35                So $cgi_data{'color'} will not exist.
36            2)  The user selects exactly one color.
37                So $cgi_data{'color'} will be the scalar value selected.
38            3)  The user selects exactly more than one color.
39                So $cgi_data{'color'} will be a reference to an array of the values selected.
40
41            To fix this you could call the parser by giving it a list of keys that you want
42            to force to be arrays.  In this case like...
43
44              use CGI::Thin;
45              my %cgi_data = &Parse_CGI ('color');
46
47            Now it they pick exactly one color, $cgi_data{'color'} will be a reference to
48            an array of the one value selected.  And thus there will be no need for
49            special cases later in the code.
50
51BUGS
52  Fixed
53
54    *   Added %([0-9a-fA-F]{2} to the regular expression to avoid
55        illegal escapes
56
57    *   Now split the key/value pairs by [;&] not just the ampersand
58
59  Pending
60
61    *   Long headers lines that have been broken over multiple lines in
62        multipart/form-data don't seem to be handled.
63
64    *   Large file uploads (like 150MB) will clobber main memory. One
65        possible addition is to change how multipart/form-data is
66        read and to spit files directly to the temp directory and
67        return to the script a filename so it can be retreived from
68        there.
69
70    *   Any thoughts on adapting it for use withing a mod_perl
71        environment?
72
73        Under Apache::Registry, which emulates a CGI environmnet, it
74        should be. Under plain ol' mod_perl, we need to interact
75        with the Apache::Request class a bit instead of %ENV and
76        STDIN.
77
78        This feature may be added in the next incarnation of the
79        module, or possibly a companion CGI::Thin::Mod_Perlish may
80        be created to do it if the code will be too different.
81
82SEE ALSO
83    CGI::Thin::Cookies
84
85SUPPORT
86        Visit CGI::Thin's web site at
87            http://www.PlatypiVentures.com/perl/modules/cgi_thin.shtml
88        Send email to
89            mailto:cgi_thin@PlatypiVentures.com
90
91AUTHOR
92        R. Geoffrey Avery
93        CPAN ID: RGEOFFREY
94        rGeoffrey@PlatypiVentures.com
95        http://www.PlatypiVentures.com/perl
96
97COPYRIGHT
98    This module is free software, you may redistribute it or modify
99    in under the same terms as Perl itself.
100
101