NAME
Xcruciate::Utils - Utilities for Xcruciate
SYNOPSIS
check_path('A very nice path',$path,'rw');
DESCRIPTION
Provides utility functions Xcruciate ( http://www.xcruciate.co.uk).
AUTHOR
Mark Howe, <melonman@cpan.org>
EXPORT
None
FUNCTIONS
check_path(option,path,permissions[,non_fatal])
Checks that the path exists, and that it has the appropriate permissions, where permissions contains some combination of r, w and x. If not, and if non_fatal is perlishly false, it dies, using the value of option to produce a semi-intelligable error message. If non_fatal is perlishly true it returns the error or an empty string.
check_absolute_path(option,path,permissions[,non_fatal])
A lot like &check_path (which it calls), but also checks that the path is absolute (ie is starts with a /).
type_check(path,name,value,record)
Returns errors on typechecking value against record. Name is provided for error messages. Path is from config file.
check_file_content
Check an XML or XSLT file
parse_xslt(file_path)
Attempts to parse a file as XSLT 1.0 and returns an error in case of failure (ie false means 'no error').
apache_time(epoch_time)
Produces an apache-style timestamp from an epoch time.
datetime(epoch_time)
Converts GMT epoch time to the format expected by XSLT date functions.
duration_in_seconds(schemaduration)
Converts an XML Schema duration into seconds (Month and Year must be zero or absent for compatibility with EXSLT's date:seconds().
index_docroot($docroot_path,$mimetypes_hash)
Returns XML describing the contents of $docroot_path.
BUGS
The best way to report bugs is via the Xcruciate bugzilla site (http://www.xcruciate.co.uk/bugzilla).
PREVIOUS VERSIONS
0.01: First upload
0.03: First upload containing module
0.04: Changed minimum perl version to 5.8.8
0.05: Added debug_list data type, fixed uninitialised variable error when numbers aren't.
0.07: Attempt to put all Xcruciate modules in one PAUSE tarball.
0.08: Added index_docroot (previously inline code in xcruciate script)
0.09: Fixed typo in error message. Use Carp for errors. Non-fatal option for check_path()
0.10: Prepend path entry to relative paths
0.12: Resolve modifiable file paths, attempt to parse XML and XSLT files
0.13: Do not attempt to parse XSLT as part of config file validation (because modifiable XSLT files will not be in place for a clean install). Add explicit function to test XSLT later.
0.14: Add doc-write to permissible debug options.
0.15: Dot optional in number data type. Remove last line of XSLT parse errors.
0.16: Integers acceptable where float requested. Added duration data type.
0.17: use warnings.
0.18: dateformat, url and timeoffset data types.
0.19: duration_in_seconds(). Better duration type checking.
0.20: Example durations in error message now legal durations. Added hexbyte, captchastyle and imagesize types.
COPYRIGHT AND LICENSE
Copyright (C) 2007 - 2009 by SARL Cyberporte/Menteith Consulting
This library is distributed under BSD licence (http://www.xcruciate.co.uk/licence-code).