NAME

Hub::Parse::Parser -

Part of the Hub Library

SYNOPSIS

DESCRIPTION

METHODS

new populate refresh tweaker
new

Usage: new

Constructor.

populate

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
refresh

Usage: refresh

Return instance to initial state.

tweaker

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 '&lt;' and '&gt;'


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

INTERNAL

_getv _populate _tweak
_getv

Get a value from the current values array

_populate

Usage: _populate [OPTIONS], \HASH+

Internal worker function.

Recursive.

PARAMETERS:

\HASH               Variable name to definition map

OPTIONS:

-text   \SCALAR     Template text to populate
_tweak

Usage: _tweak

Internal function.

Tweak values.

Subroutine for tweaking must be provided in the constructor.

AUTHOR

Ryan Gies

COPYRIGHT

Copyright (c) 2006 Livesite Networks, LLC. All rights reserved.

Copyright (c) 2000-2005 Ryan Gies. All rights reserved.

UPDATED

This file created by on at