NAME

Data::Phrasebook::Loader::Text - Absract your phrases with plain text files.

SYNOPSIS

use Data::Phrasebook;

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

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

ABSTRACT

This module provides a loader class for phrasebook implementations using plain text files.

DESCRIPTION

This loader plugin implements phrasebook patterns using plain text files.

Phrases can be contained within one or more dictionaries, with each phrase accessible via a unique key. Phrases may contain placeholders, please see Data::Phrasebook for an explanation of how to use these. Groups of phrases are kept in a dictionary. In this implementation a single file is one complete dictionary.

An example plain text file:

foo=Welcome to [% my %] world. It is a nice [% place %].

Within the phrase text placeholders can be used, which are then replaced with the appropriate values once the get() method is called. The default style of placeholders can be altered using the delimiters() method.

INHERITANCE

Data::Phrasebook::Loader::Text inherits from the base class Data::Phrasebook::Loader::Base. See that module for other available methods and documentation.

METHODS

load

Given a file, load it. file must contain a valid phrase map.

$loader->load( $file );

This method is used internally by Data::Phrasebook::Generic's data method, to initialise the data store.

get

Returns the phrase stored in the phrasebook, for a given keyword.

my $value = $loader->get( $key );

SEE ALSO

Data::Phrasebook.

SUPPORT

Please see the README file.

AUTHOR

Barbie, <barbie@cpan.org>
for Miss Barbell Productions <http://www.missbarbell.co.uk>.

LICENCE AND COPYRIGHT

Copyright (C) 2004-2005 Barbie for Miss Barbell Productions.

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 Artistic and COPYING files included with this module, or in perlartistic and perlgpl in Perl 5.8.1 or later.