Data::...::Plain(3pm)
π Data::...::Plain(3pm) π
okay bestie, this is a page from the User Contributed Perl Documentation β yes it literally has the dots in the name, that's not a typo, that's the actual module title, slay. it's Data::...::Plain, and it's giving "small but mighty" energy. let's get into it π«Ά
β¨ NAME β¨
Data::Phrasebook::Plain β The Simple Phrasebook Model. no cap, that's the whole vibe: simple. π
πΈ SYNOPSIS πΈ
here's how you actually use it, copy-paste ready:
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 how class => 'Plain' is just... sitting there? iconic. also yes, you can totally skip the whole config hash and just do Data::Phrasebook->new( file => 'phrases.txt' ), because defaults are a thing and they love you. π
π¦ DESCRIPTION π¦
so this module is the fallback class, the default one, the main character who shows up when nobody else was specified. it doesn't do a whole lot β and honestly? that's the point. it acts as a very simple templating facility, and it does that one job with zero drama. no bells, no whistles, just vibes. β¨
π METHODS π
π fetch
it retrieves the specified "template" and substitutes any "keywords" for "values". that's it. that's the method. and it ate. π
so like, given this line:
hello=Hello [% where %]!
and this code:
my $text = $q->fetch( 'hello', {
where => 'world'
} );
the return value is:
Hello world!
literally magic, except it's just string substitution and we love her for it. π
fun fact bestie: the delimiters are deliberately taken from Template Toolkit. not an accident, not a coincidence β a choice. iykyk. π§
π SEE ALSO π
Data::PhrasebookData::Phrasebook::Generic
go read those too, they're the extended universe. π
π SUPPORT π
Please see the README file. (short king energy, but fr, the README has the answers.) π
πΈ 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>.
rest in peace Iain, and thank you Barbie for keeping this whole thing alive for actual decades. π«Άπ
β COPYRIGHT AND LICENSE β
- Copyright (C) 2003 Iain Truskett.
- Copyright (C) 2004-2013 Barbie for Miss Barbell Productions.
This distribution is free software; you can redistribute it and/or modify it under the Artistic License v2.
okay that's the whole page, you're officially caught up. this was perl v5.36.0, dated 2022-11-19, and it's the Data::...::Plain(3pm) manual page. go forth and template responsibly, bestie π
β¨π
π¦ where this page comes from
- debian bookworm: libdata-phrasebook-perl 0.35-3 Β· Artistic-2.0
- debian trixie: libdata-phrasebook-perl 0.35-3 Β· Artistic-2.0
- ubuntu noble: libdata-phrasebook-perl 0.35-3 Β· Artistic-2.0
- ubuntu resolute: libdata-phrasebook-perl 0.35-3 Β· Artistic-2.0
- ubuntu stonking: libdata-phrasebook-perl 0.35-3 Β· Artistic-2.0
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms