Locale::MakePhrase::Utils - Collection of useful functions


Locale-MakePhrase documentation  | view source Contained in the Locale-MakePhrase distribution.

Index


NAME

Top

Locale::MakePhrase::Utils - Collection of useful functions

SYNOPSIS

Top

This module implements some useful functions used within the Locale::MakePhrase modules.

FUNCTIONS

Top

The functions we export:

boolean is_number(value)

Returns true/false indicating if the value is numeric.

string left(string,length)

Return the left part of a sub-string.

string right(string,length)

Return the right part of a sub-string.

string alltrim(string)

Trim all leading and trailing whitespace.

void die_from_caller($message)

Throw an exception, from a caller's perspective (ie: not from within the Locale::MakePhrase modules). This allows us to generate an error message for which the user can figure out what they did wrong.

Note: if you set Locale::MakePhrase::Utils::DIE_FROM_CALLER to a value other than zero, die_from_caller() will recurse that number of levels further up the stack backtrace, before die()ing. This allows you to wrap your $makePhrase->translate(...) calls in a global wrapper function; eg: by setting the value to 1, the message is displayed with respect to one level up of your applications' calling code.


Locale-MakePhrase documentation  | view source Contained in the Locale-MakePhrase distribution.