NAME
Mail::SpamCannibal::WebService - web utilities
SYNOPSIS
use Mail::SpamCannibal::WebService qw(
sendhtml
load
html_cat
make_jsPOP_win
http_date
cookie_date
unescape
get_query
);
sendhtml(\$htmltext,\%extraheaders);
$htmltext = load($filename);
$hc = html_cat(\$htmltext,$name,\%filehash,\%texthash);
$html=make_jsPOP_win($name,$width,$height);
$time_string = http_date($time);
$time_string = cookie_date($time);
$string = unescape($escape_string);
$query || %query = get_query();
DESCRIPTION
Mail::SpamCannibal::WebService provides utilities to facilitate web page generation and delivery.
sendhtml(\$htmltext,\%extraheaders);
Send html via Apache::mod-perl if present, else using a print statement.
input: html text reference. extra header reference returns: <nothing>
Extra headers are of the form:
$extra_headers = { header => value, ... etc... };
$htmltext = load($filename);
Return the contents of $filename;
html_cat(\$htmltext,$name,\%filehash,\%texthash);
This function loads text from a file pointed to by a hash of the form:
$file = { name1 => './path/to/filename1.ext', name2 => './path/to/filename2.ext', name3 => '....etc...', }
html_cat retrieves the contents of the file and places it in the storage hash for later use.
$ftext = { name1 => 'text contents 1', name2 => '...etc...', }
If the text exists in the storage hash, it is not retrieved from the file system. The text requested by $name is concatenated to the scalar referenced by the pointer to $htmltext.
input: $html out pointer, $name -- hash key, $file hash pointer, $text cache hash pointer returns: true on success, else false
$html=make_jsPOP_win($name,$width,$height);
This function makes the javascript code to generate a pop-up window. The function name created is 'popwin', the name and size are arguments to the function call.
input: window name, width [optional - 500 def] height [optional - 400 def] returns: html text
The javascript function creates a global variable of the name $name and takes the argument "color"
i.e. var $name; popwin(color);
and always returns "false". The default color is light yellow [#ffffcc] if no color is specified.
$time_string = http_date($time);
Returns time string in HTTP date format, same as... Apache::Util::ht_time(time, "%a, %d %b %Y %T %Z",1)); i.e. Sat, 13 Apr 2002 17:36:42 GMT
$time_string = cookie_date($time);
Returns time string in Cookie format, similar to http_date. HTTP uses space ' ' as a seperator whereas Cookies use a dash '-'. i.e. Sat, 13-Apr-2002 17:36:42 GMT
$string = unescape($escape_string);
Return unescaped string for escape_string. First converts +'s to spaces.
input: URL escaped string return: clean string
$query || %query = get_query();
Return the query string or hash of query key/value pairs. The routine checks for POST or GET method and reads the query response accordingly.
In scalar mode, returns the query string. In array/hash mode, it returns the key value pairs.
input: none returns: query string or array of key/value pairs
Note: in scalar form, the unescaped query string is returned to preserve possible imbedded '=' characters.
In array form, duplicate keys have their values appended to previous key/value pair with a null (\0) separator.
DEPENDENCIES
none
EXPORT_OK
sendhtml
load
make_jsPOP_win
http_date
cookie_date
unescape
get_query
COPYRIGHT
Copyright 2003, Michael Robinton <michael@bizsystems.com>
This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
AUTHOR
Michael Robinton <michael@bizsystems.com>