NAME XApperator::Utils - General utils component in XApperator MVC framework VERSION 1.0.2 This Release: 11/Dec/2007 Original Release: 20/Feb/2007 AUTHOR Dean Stringer (deeknow @ pobox . com) DESCRIPTION All subs in Utils.pm are general purpose or read-only functions that are independant of the current application data, state or representation. dieNice() Is called whenever we've encountered what seems like a fatal error. Checks the value of 'dieOnError' and if set to '1' will actually die, otherwise simply 'warn's the passed error message. Also checks 'detailsToUser' and if set to a non null vaule will return the error to the controller.cgi. Whatever the result the attribute 'error' is loaded with the passed message and this can be inspected by the controller.cgi script. PRIVATE(ish) SUBS The following should all only be used internally by the XApperator object itself. They are called directly by each other or by the three public subs new(), buildMenu() or processActions() _debug() called when we want to log some debug info to the log file _filterStopwords() Takes a scalar, filters out the stop-words and single characters and push those that arent onto a new keyword list, and returns the list as a scalar by joining the members with a 'space' _getDateTime() Used by XApperator::new() to get date/time values and set propertites $self->{dateToday} and $self->{timeNow} to ISO8601 like values to be used in the XSLT (e.g. '20051230' and '2359') _getDateDisplay() renders a date string for display, e.g. "Mon Aug 8 12:38:11 2005". is mostly used when writing log entries _registerFunctions() Registers custom perl functions that will then be accessable to the XSLT templates. You should add any new subs here and to access them from your template add the following namespace declaration in the root xsl:stylesheet element: xmlns:xapp="http://xapperator.sourceforge.net/" The two functions currently registered are: displayPrep() - passed a string of HTML and if it contains any escaped left or right hand brackets (< and >) will unescape them back into their original < and >. Used in the publishing stage in the sample CMS app for displaying easily editable brackets in HTML form elements. Not required for normal XApp editing use intToMonthShort() - if passed an integer between 0 and 11 will return a short month name from a fixed array of names (e.g. Jan, Feb, Mar etc). Also used in the CMS app and not required for general purpose XApp use. NOTE: these should really be abstracted out to a seperate module so developers can extend the function set independently of the XApp distribution _sanitisePath() Removes any '../' strings found in a passed path returning the sanitised value. Currently only called by _parseCGIParams() _warn() called when we experience a non-fatal error that we want to log, but still want to return and continue with processing, probably spitting something useful back to the user later.