PSP::CGI::Generate - exports code generation functions commonly used in CGI programs.
my $string = generateForm($hash,\%hash, { key1 => 'value in anonymous hash', key2 => 'another value!' } ); my $string = generateForm(%hash); my $string = generateForm( key1 => 'value from a common hash', key2 => 'another value!' ); my $string = generateGet($hash,\%hash, { key1 => 'value in anonymous hash', key2 => 'another value!' } ); my $string = generateGet(%hash); my $string = generateGet( key1 => 'value from a common hash', key2 => 'another value!' );
This module exports few functions that generate XHTML code and HTTP request strings from Perl data structures. This module was creates as a companion to the Perl Script Pages Engine. See the PSP::Engine manpage for more information.
Generates a XHTML 1.1 compliant <input type=``hidden''> tags from either one or more references to hashs or anonymous hashs.
my $string = generateForm($hash,\%hash, { key1 => 'value in anonymous hash', key2 => 'another value!' } );
or from a single regular hash:
my $string = generateForm(%hash); my $string = generateForm( key1 => 'value from a common hash', key2 => 'another value!' );
The last example will generate the following XHTML code:
``<input type="hidden" name="key1" value="value from a common hash" /><input type="hidden" name="key2" value="another value!" />
''
The keys and values are automatically passed through the htmlize function from PSP::CGI::Transform, so you do not need to take care for quoting or XHTML compliance in your input data.
This function is exported automatically.
None.
Generates a HTTP GET string from either one or more references to hashs or anonymous hashs.
my $string = generateGet($hash,\%hash, { key1 => 'value in anonymous hash', key2 => 'another value!' } );
or from a single regular hash:
my $string = generateGet(%hash); my $string = generateGet( key1 => 'value from a common hash', key2 => 'another value!' );
The last example will generate the following HTTP GET string:
``key1=value+from+a+common+hash&key2=another+value%21
''
As the return string may contain ``&'' characters, please remember to pass it through the htmlize function from PSP::CGI::Transform or use the PrintSecureOpenTag if you want to print the resulting data into (X)HTML code.
This function is exported automatically.
None.
Veit Wahlich
E-Mail: cru |at| zodia |dot| de
WWW: http://home.ircnet.de/cru/
v0.7 Wednesday, 18 January 2006
Copyright 2004-2006 Veit Wahlich
This software is distributed as free (libre) software under the terms of the GNU General Public License, version 2 <http://www.gnu.org/copyleft/gpl.html>. The author disclaims responsibility of any damage or harm caused directly or indirectly by usage of this software. Use only at your own risk.