NAME

Data::Phrasebook::Plain - Simplistic phrasebooking.

SYNOPSIS

    use Data::Phrasebook;

    my $q = Data::Phrasebook->new(
        class  => 'Plain',
        loader => 'Text',
        file   => 'phrases.txt',
    );

    my $r = Data::Phrasebook->new( file => 'phrases.txt' );

   $q->delimiters( qr{ \[% \s* (\w+) \s* %\] }x );
	my $phrase = $q->fetch($keyword);

DESCRIPTION

This module is the fallback or default phrasebook class. It doesn't do much except act as a very simple templating facility.

METHODS

fetch

Retrieves the specified template and substitutes any keywords for values.

Thus, given:

hello=Hello [% where %]!

And code:

my $text = $q->fetch( 'hello', {
    where => 'world'
} );

Return value is:

Hello world!

The delimiters are deliberately taken from Template Toolkit.

delimiters

Returns or sets the current delimiters for tags. Must be a regex with at least one capture group.

This example also shows the default regex.

$q->delimiters( qr{ \[% \s* (\w+) \s* %\] }x );

SEE ALSO

Data::Phrasebook, Data::Phrasebook::Generic

AUTHOR

Original author: Iain Campbell Truskett (16.07.1979 - 29.12.2003).

Maintainer: Barbie <barbie@cpan.org>.

LICENCE AND COPYRIGHT

Copyright E<copy> Iain Truskett, 2003. All rights reserved.
Copyright E<copy> Barbie, 2004-2005. All rights reserved.

This library is free software; you can redistribute it and/or modify
it under the same terms as Perl itself.

The full text of the licences can be found in the F<Artistic> and
F<COPYING> files included with this module, or in L<perlartistic> and
L<perlgpl> in Perl 5.8.1 or later.