NAME
PApp::Util - various utility functions that didn't fit anywhere else
SYNOPSIS
use PApp::Util;
DESCRIPTION
- format_source $source
-
Formats a file supposed to be some "sourcecode" (e.g. perl, papp, xslt etc..) into formatted ascii. It includes line numbering at the front of each line and handles embedded "#line" markers.
- dumpval any-perl-ref
-
Tries to dump the given perl-ref into a nicely-formatted human-readable-format (currently uses either Data::Dumper or Dumpvalue) but tries to be very robust about internal errors, i.e. this functions always tries to output as much usable data as possible without die'ing.
- digest(args...)
-
Calculate a SHA1 digest and return it base64-encoded. The result will always be 27 characters long.
- append_string_hash $hashref1, $hashref2
-
Appends all the strings found in $hashref2 to the respective keys in $hashref1 (e.g. $h1->{key} .= $h2->{key} for all keys).
- @ = uniq @array
-
Returns all the elements that are unique inside the array. The elements must be strings, or at least must stringify sensibly.
- sv_peek $sv
- sv_dump $sv
-
Returns a very verbose dump of the internals of the given sv. Calls the
sv_peek
(sv_dump
) core function. If you don't know what I am talking about then this function is not for you. Or maybe you should try it ;) - fetch_uri $uri
-
Tries to fetch the document specified by
$uri
, returningundef
on error. As a special "goody", uri's of the form "data:,body" will immediately return the body part. - find_file $uri [, \@extensions] [, @bases]
-
Try to locate the specified document. If the uri is a relative uri (or a simple unix path) it will use the URIs in
@bases
and PApp's search path to locate the file. If bases contain an arrayref than this arrayref should contain a list of extensions (without a leading dot) to append to the URI while searching the file. - load_file $uri [, @extensions]
-
Locate the document specified by the given uri using
find_file
, then fetch and return it's contents usingfetch_uri
.
SOURCE FILTERING
A very primitive form of source filtering can be implemented using filter_add
, filter_read
and filter_simple
. Better use the Filter module family, though.
SEE ALSO
PApp.
AUTHOR
Marc Lehmann <pcg@goof.com>
http://www.goof.com/pcg/marc/