|
Apache::Wyrd::Services::SAK - Swiss Army Knife of common subs |
Apache::Wyrd::Services::SAK - Swiss Army Knife of common subs
use Apache::Wyrd::Services::SAK qw(:hashes spit_file);
``Swiss Army Knife'' of functions used in Apache::Wyrd.
(format: (returns) name (arguments)) for regular functions.
(format: (returns) $wyrd->name (arguments)) for methods
Functions for working with databases. Designed for use with a
combination of Apache::Wyrd::Interfaces::Setter and the DBI-compatible
database stored in Apache::Wyrd::DBL.
$wyrd->cgi_query(scalar)
$sh = $wyrd->cgi_query(
'select names from people where name=$:name'
);
$wyrd->cgi_query('delete from people where id=$:id');
$wyrd->do_query(scalar, [hashref])Apache::Wyrd::Interfaces::Setter. Unknown variables will be
made NULL for the query. The query is then executes and the DBI handle to the
query is returned.
$sh = $wyrd->do_query(
'select names from people where name=$:name', {name => $name}
);
$wyrd->do_query('delete from people');
set_clause(array)Apache::Wyrd::Interfaces::Setter when given an array of column names.
Old-style file routines.
slurp_file(scalar)spit_file(scalar, scalar)slurp_file. The second argument is the contents of the file.
A positive response means the file was successfully written.
Helpful routines for handling hashes.
array_4_get (array)data_clean(scalar)env_4_get([array/hashref])data_clean(hashref)sort_by_ikey(a_hashref, b_hashref, array of keys)
sort {sort_by_ikey($a, $b, 'lastname', 'firstname')} @array
sort_by_key(a_hashref, b_hashref, array of keys)sort_by_ikey
sort {sort_by_key($a, $b, 'lastname', 'firstname')} @array
token_hash(scalar, [scalar])token_hash on a string and returning a hash with
positive values for every token. Useful for making a hash that can be easily
used to check against the existence of a token in a string.
token_parse(scalar, [regexp])
token_parse('each peach, pear, plum')
returns
(q/each peach/, q/pear/, q/plum/)
and
token_parse('every good boy does fine')
returns
qw(every good boy does fine)
uniquify_by_ikey(scalar, array of hashrefs)uniquify_by_key(scalar, array of hashrefs)uniquify_by_ikey.
uri_escape(scalar, array of hashrefs)
Quick and dirty interfaces to sendmail
send_mail (hashref)
String manipulations.
commify (array)
Tag-generation tools.
attopts_template (array)
Barry King <wyrd@nospam.wyrdwright.com>
Copyright 2002-2004 Wyrdwright, Inc. and licensed under the GNU GPL.
See LICENSE under the documentation for Apache::Wyrd.
|
Apache::Wyrd::Services::SAK - Swiss Army Knife of common subs |