This package contains routines and functions that have no dependence on other ExSite code.
For purposes of decoding input, these tools are deprecated. See ExSite::Input for better input management. These tools may still be used for general-purpose hash encoding, however.
EncodeHash(%hash)
&EncodeHash
.
DecodeString($string)
Multiply-defined keys have their values appended to each other,
separated by the value of $multi_sep
(``; '' by default).
DecodeQuery()
DecodePost()
Decode the POST data. For URL-encoded form data, passes the data though &DecodeString(). Multipart-encoded data is more complex (and required for file uploads); in that case, the CGI:: package is used to parse the data.
DecodeInput()
Decodes the input to the page. Decodes either the POST or QUERY data, depending on the REQUEST_METHOD.
columnwise($ref)
input: an array of hash references with identical keys.
output: a hash of arrays, indexed by the same keys. For instance,
( { a=>1, b=>2 }, { a=>3, b=>4 }, { a=>5, b=>6 } )
becomes ( a => [1,3,5], b => [2,4,6] )
keywise($key,$ref)
input: a hash key to index on, and an array of hash references
output: a hash of hashes, indexed by one of the keys. It is assumed that the value associated with this key is unique across all the hashes. If not, the last such key is used.
For example, taking ( { a=>1, b=>2 }, { a=>3, b=>4}, { a=>5, b=>6 } )
and indexing it by key ``a'', gives
{ 1=>{a=>1,b=>2}, 3=>{a=>3,b=>4 }
.
url_escape($text,$escape_chars)
$text
by escaping the
characters in $escape_chars
. If $escape_chars
is not given, escapes
these characters by default:
%+ &@"?#
url_unescape($text)
$text
, restoring the plaintext.
html_escape($text,$escape_chars,$use_wierd_amp_esc)
$text
by escaping the
characters in $escape_chars
. If $escape_chars
is not given,
the following characters are escaped by default:
&<>"
$use_wierd_amp_esc
is a flag, which if true, causes ``&'' to be
escaped with a non-standard escape code ``<!amp>''. This is sometimes
necessary to prevent the HTML editor from mangling our escape codes,
as some client browsers will rewrite the HTML against our wishes.
html_unescape($text,$escape_chars,$use_wierd_amp_esc)
html_escape()
.
safetext($text)
safe(er)
for use as
variable names or field IDs.
unsafetext($text)
substitute($subhash,$startmark,$endmark)
Replaces marker tags such as ``[[tag]]'' with the value in $subhash{"tag"}
.
Does so for all such tags in the text. Tags may contain word
characters only (alphanumeric plus _).
html_to_plaintext($html)
randtext($len,$src)
$len
, and composed of characters from $src
. Both parameters are
optional. Default length is 7-10 characters, and the default source string
includes most of the printable ASCII character set.
This is useful as a secure pasword or passkey generator.
MimeType($filename)
MimeToFile($mimetype)
ShowHash()
get_file($opt)
$opt
is a hash reference, which
presently only accepts one key:
relink(%param)
To set a new parameter, give the parameter a value in %param
. To clear
a parameter, set its value in %param
to undef
.
relink()
returns the new URL to link to.
To link back to the same URL, use &relink();
, not &relink;
.
See also Modules::BaseDCD::link(), which is better for relinking into a dynamic content module.