Template::Plugin::Lingua::Conjunction - Template Toolkit plugin for human-readable lists
[% USE Lingua.Conjunction %] [% Lingua.Conjunction.conjunction("Alice", "Bob", "Charlie") %] have secrets from [% Lingua.Conjunction.list("Eve", "Mallory") %] Alice, Bob, and Charlie have secrets from Eve and Mallory.
Lingua::Conjunction is a module to create sentence-style, human-readable lists of items from a Perl list. For example, given the list ("foo", "bar", "baz") it would return the string "foo, bar, and baz". If any of the strings in the list had a comma in them, it would switch to using a semicolon. It supports multiple languages and use of arbitrary separator characters. It handles any number of items gracefully, even two or one.
Template::Plugin::Lingua::Conjunction is a wrapper around this module so that it can be used from the Template Toolkit.
The main method of this plugin is conjunction (or list for short). It takes a list of items or arrays of items which should be converted and returns a human-readable string representation.
conjunction
list
Template::Plugin::Lingua::Conjunction also supports Lingua::Conjunction's settings methods, namely lang, separator, separator_phrase, connector_type, and penultimate. For documentation on them, see Lingua::Conjunction.
lang
separator
separator_phrase
connector_type
penultimate
Lingua::Conjunction, Template::Manual
Brent Royal-Gordon <brentdax@cpan.org>
Copyright (C) 2006 by Brent Royal-Gordon
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.8.7 or, at your option, any later version of Perl 5 you may have available.
To install Template::Plugin::Lingua::Conjunction, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Template::Plugin::Lingua::Conjunction
CPAN shell
perl -MCPAN -e shell install Template::Plugin::Lingua::Conjunction
For more information on module installation, please visit the detailed CPAN module installation guide.