NAME
PLP::Fields - Special hashes for PLP
DESCRIPTION
For your convenience, PLP uses hashes to put things in. Some of these are tied hashes, so they contain a bit magic. For example, building the hash can be delayed until you actually use the hash.
%get
and%post
-
These are built from the
key=value&key=value
(orkey=value;key=value
strings in query string and post content.%post
is not built if the content type is notapplication/x-www-form-urlencoded
. In post content, the semi-colon is not a valid separator.These hashes aren't built until they are used, to speed up your script if you don't use them. Because POST content can only be read once, you can
use CGI;
and just never access%post
to avoid its building.With a query string of
key=firstvalue&key=secondvalue
,$get{key}
will contain onlysecondvalue
. You can access both elements by using the array reference$get{'@key'}
, which will contain[ 'firstvalue', 'secondvalue' ]
. %fields
-
This hash combines %get and %post, and triggers creation of both. POST gets precedence over GET (note: not even the
@
-keys contain both values). -
This is built immediately, because cookies are usually short in length. Cookies are not automatically url-decoded.
%header
,%headers
-
In this hash, you can set headers. Underscores are converted to normal minus signs, so you can leave out quotes. The hash is case insensitive: the case used when sending the headers is the one you used first. The following are equal:
$header{CONTENT_TYPE} $header{'Content-Type'} $header{Content_Type} $headers{CONTENT_type}
AUTHOR
Juerd Waalboer <juerd@juerd.nl>