1Locale::TextDomain::OO:U:sLeerLxoiCccoaonlnte:r::i:RbToueltxeet:dD:oSPmteaorirlne:FD:ioOlcOtu:em:reL(ne3tx)aitcioonn::Role::StoreFilter(3)
2
3
4

NAME

6       Locale::TextDomain::OO::Lexicon::Role::StoreFilter - Filters the
7       lexicon data before stored
8
9       $Id: StoreFilter.pm 573 2015-02-07 20:59:51Z steffenw $
10
11       $HeadURL:
12       svn+ssh://steffenw@svn.code.sf.net/p/perl-gettext-oo/code/module/trunk/lib/Locale/TextDomain/OO/Lexicon/Role/StoreFilter.pm
13       $
14

VERSION

16       1.017
17

DESCRIPTION

19       This module filters the lexicon data before stored.
20
21       The idea is: Not all parts of lexicon are used by other programming
22       languages.
23
24       Implements attributes "filter_language", "filter_category",
25       "filter_domain" and "filter_project".  There it is possible to store
26       undef for ignore filter, a string to check equal, a regex reference to
27       match or a code reference to do some more complicate things.
28
29       That filter removes also the key "plural_code" from header.  That is an
30       already prepared Perl code reference to calculate what plural form
31       should used.  The other language has to create the code again from key
32       header key "plural".  That contains that pseudo code from po/mo file
33       without ";" and/or "\n" at the end.
34

SYNOPSIS

36           with qw(
37               Locale::TextDomain::OO::Lexicon::Role::StoreFilter
38           );
39
40       Usage of that optional filter
41
42           use Locale::TextDomain::OO::Lexicon::Store...;
43
44           my $obj = Locale::TextDomain::OO::Lexicon::Store...->new(
45               ...
46               # all parameters optional
47               filter_language => undef,
48               filter_category => 'cat1',
49               filter_domain   => qr{ \A dom }xms,
50               filter_project  => sub {
51                   my $filter_name = shift;   # $filter_name eq 'filter_project'
52                   return $_ eq 'my project'; # $_ contains the value
53               },
54           );
55           $obj->copy;
56           $obj->clear_filter;
57           $obj->filter_language('en');
58           $obj->remove;
59           $obj->to_...;
60

SUBROUTINES/METHODS

62   method filter_language, filter_category, filter_domain, filter_project
63       Set a filter as undef, string, regex or code reference.
64
65   method clear_filter
66       Set filter_language, filter_category, filter_domain, filter_project to
67       undef.
68
69           $obj->clear_filter;
70
71   method copy
72       Copies lexicon entries with matching filter from singleton lexicon to
73       data (new lexicon).
74
75           $obj->copy;
76
77   method remove
78       Removes lexicon entries with matching filter from data (new lexicon).
79
80           $obj->remove;
81
82   method data
83       Get back that filtered lexicon data.
84
85           $data = $obj->data;
86

EXAMPLE

88       Inside of this distribution is a directory named example.  Run this
89       *.pl files.
90

DIAGNOSTICS

92       none
93

CONFIGURATION AND ENVIRONMENT

95       none
96

DEPENDENCIES

98       Carp
99
100       Clone
101
102       Locale::TextDomain::OO::Singleton::Lexicon
103
104       Locale::TextDomain::OO::Util::JoinSplitLexiconKeys
105
106       Moo::Role
107
108       MooX::Types::MooseLike::Base
109
110       namespace::autoclean
111

INCOMPATIBILITIES

113       not known
114

BUGS AND LIMITATIONS

116       none
117

SEE ALSO

119       Locale::TextDoamin::OO
120

AUTHOR

122       Steffen Winkler
123
125       Copyright (c) 2013 - 2015, Steffen Winkler "<steffenw at cpan.org>".
126       All rights reserved.
127
128       This module is free software; you can redistribute it and/or modify it
129       under the same terms as Perl itself.
130
131
132
133perl v5.34.0             Locale::T2e0x2t1D-o0m7a-i2n2::OO::Lexicon::Role::StoreFilter(3)
Impressum