NAME

Template::Plugin::Lingua::EN::Inflexion - Interface to Lingua::EN::Inflexion module

SYNOPSIS

[% USE infl = Lingua.EN.Inflexion; -%]
[% n = 42; FILTER inflect; -%]
  <#d:$n>There <V:was> <#n:$n> <N:error>.
  <A:This> <N:error> <V:was> fatal.
  ... and <#o:9>ly...
[% END; -%]

# Output:
#   There were 42 errors.
#   These errors were fatal.
#   ... and 9thly...

DESCRIPTION

The Lingua::EN::Inflexion Plugin is an interface to Damian Conway's Lingua::EN::Inflexion Perl module, which provides plural inflections, "a"/"an" selection for English words, and manipulation of numbers as words. The plugin provides an 'inflect' filter, which can be used to interpolate inflections in a string.

For the full gory details of the inflection functionality refer to the Lingua::EN::Inflexion manual.

METHODS

new

my $infl = Template::Plugin::Lingua::EN::Inflexion->new ($context);

The constructor takes one argument which is the context on which the filter will be defined and returns the new object. You will not need to call this explicitly within a template, just USE the plugin as normal:

[% USE infl = Lingua.EN.Inflexion; -%]

noun

my $plural = $infl->noun ('dog')->plural;

The noun method is a wrapper around Lingua::EN::Inflexion::noun() and returns an object of Lingua::EN::Inflexion::Noun.

verb

my $plural = $infl->verb ('dog')->plural;

The verb method is a wrapper around Lingua::EN::Inflexion::verb() and returns an object of Lingua::EN::Inflexion::Verb.

adj

my $plural = $infl->adj ('canine')->plural;

The adj method is a wrapper around Lingua::EN::Inflexion::adj() and returns an object of Lingua::EN::Inflexion::Adj.

wordlist

my $list = $class->wordlist (@fruits);

The wordlist method is a wrapper around Lingua::EN::Inflexion::wordlist() and returns a scalar string.

INTERNAL METHODS

tt_inflect ($string)

The underlying inflect filter.

TODO

Finish off documenting the object methods.

Provide tests for all methods in the test suite.

SEE ALSO

Lingua::EN::Inflexion, Template, Template::Plugin, Template::Plugin::Lingua::En::Inflect

AUTHOR

Written and maintained by Pete Houston.

ACKNOWLEDGEMENTS

This module was inspired by and borrows very heavily from Template::Plugin::Lingua::En::Inflect, originally written by Andrew Ford and maintained by Barbie.

Damian Conway <damian@conway.org> wrote the Lingua::EN::Inflexion module, which does all the heavy lifting.

COPYRIGHT & LICENSE

Parts of Template::Plugin::Lingua::En::Inflect retained here are

    Copyright © 2005-2014 Andrew Ford Copyright © 2014-2015 Barbie for Miss Barbell Productions.

Other works are

    Copyright © 2019 Pete Houston

This distribution is free software; you can redistribute it and/or modify it under the Artistic Licence v2.