Hub::Parse::Parser -
Part of the Hub Library
new | populate | refresh | tweaker |
Usage: new
Constructor.
Usage: populate \HASH+
Populate our template with provided variable definitions.
PARAMETERS:
\HASH Variable name to definition map
Example: This example:
my $parser = mkinst( 'Parser', -template => 'Hello ' );
matches:
Hello World
Usage: refresh
Return instance to initial state.
Usage: tweaker \$value, $tweak+
Tweaks allow modification to variable values. This is expensive, and hence should be used only as a last resort.
No spaces are allowed in the tweak name!
Variables have to be specified as {#name} (not ) because of the use of s/name/value/g in the main populate routine.
Implemented tweaks:
! # Run command (custom tweak)
tr/// # transliterates search chars with replacement chars lc # lower case uc # upper case lcfirst # lower case first letter ucfirst # upper case first letter x= # repeat the value so many times
esc # escape non-word characters html # replace '<' and '>' with '<' and '>'
num # number (will use zero '0' if empty) dt(opts) # datetime with options (see datetime).
dhms(opts) # day/hour/min/sec with options (see dhms).
eq # equal ne # not equal gt # greater than lt # less than if # is greater than zero (or non-empty string)
- # minus + # plus * # multiply / # divide % # mod
_getv | _populate | _tweak |
Usage: _populate [OPTIONS], \HASH+
Internal worker function.
Recursive.
PARAMETERS:
\HASH Variable name to definition map
OPTIONS:
-text \SCALAR Template text to populate
Usage: _tweak
Internal function.
Tweak values.
Subroutine for tweaking must be provided in the constructor.
Ryan Gies
Copyright (c) 2006 Livesite Networks, LLC. All rights reserved.
Copyright (c) 2000-2005 Ryan Gies. All rights reserved.
This file created by on at