logo
Free, unlimited AI code reviews that run on commit
git-lrc git-lrc GitHub Install Now We'd appreciate a star git-lrc - Free, unlimited AI code reviews that run on commit | Product Hunt git-lrc - Free, unlimited AI code reviews that run on commit | Product Hunt

Data::Phrasebook::Plain - The Simple Phrasebook Model.

Author

         Original author: Iain Campbell Truskett (16.07.1979 - 29.12.2003)
         Maintainer: Barbie <barbie@cpan.org> since January 2004.
         for Miss Barbell Productions <http://www.missbarbell.co.uk>.

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.

Name

       Data::Phrasebook::Plain - The Simple Phrasebook Model.

See Also

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

Support

       Please see the README file.

Synopsis

           use Data::Phrasebook;

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

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

           # simple keyword to phrase mapping
           my $phrase = $q->fetch($keyword);

           # keyword to phrase mapping with parameters
           $q->delimiters( qr{ \[% \s* (\w+) \s* %\] }x );
           my $phrase = $q->fetch($keyword,{this => 'that'});

See Also