1Perl::Critic::Policy::MUissePcreerlCllo:an:ntCerraii:bt:uiTtcee:xd:tPDPooelmrialciynD:Uo:ncMuuismseecdne(tl3al)tainoena::TextDomainUnused(3)
2
3
4

NAME

6       Perl::Critic::Policy::Miscellanea::TextDomainUnused - check for
7       Locale::TextDomain imported but unused
8

DESCRIPTION

10       This policy is part of the "Perl::Critic::Pulp" add-on.  It reports
11       when you have "Locale::TextDomain" like
12
13           use Locale::TextDomain ('MyMessageDomain');
14
15       but then don't use any of its functions or variables
16
17           __ __x __n __nx __xn
18           __p __px __np __npx
19           N__ N__n N__p N__np
20           %__ $__
21
22       "Locale::TextDomain" is not needed when not used, but it's also not
23       actively harmful so this policy is only low severity and under the
24       "cosmetic" theme (see "POLICY THEMES" in Perl::Critic).
25
26       The check is good if you've got "Locale::TextDomain" as boilerplate
27       code in most of your program, but in some modules it's unused.  You can
28       remove it entirely from non-interactive modules, or comment it out from
29       modules which might have messages but don't yet.  The best thing picked
30       up is when your boilerplate has got into a programmatic module which
31       shouldn't say anything at the user level.
32
33       The saving from removing unused "Locale::TextDomain" is modest, just
34       some imports and a hash entry holding the "textdomain" for the package.
35
36       It's easy to imagine a general kind of "module imported but unused"
37       policy check, but in practice its hard for perlcritic to know the
38       automatic imports of every module, and quite a few modules have side-
39       effects, so this TextDomainUnused policy just starts with one case of
40       an unused include.
41
42   Interpolated Variables
43       The variables "%__" and "$__" are recognised in double-quote
44       interpolated strings just by looking for a "$__" somewhere in the
45       string, eg.
46
47           print "*** $__{'A Message'} ***\n";  # ok
48
49       It's not hard to trick the recognition with escapes, or a hash slice
50       style, but in general taking any "$__" to be a TextDomain use is close
51       enough.  (Perhaps in the future PPI will do a full parse of
52       interpolated expressions.)
53

SEE ALSO

55       Perl::Critic::Pulp, Perl::Critic, Locale::TextDomain,
56       Perl::Critic::Policy::Miscellanea::TextDomainPlaceholders
57

HOME PAGE

59       <http://user42.tuxfamily.org/perl-critic-pulp/index.html>
60
62       Copyright 2009, 2010, 2011, 2012, 2013, 2014, 2015, 2016, 2017, 2019,
63       2021 Kevin Ryde
64
65       Perl-Critic-Pulp is free software; you can redistribute it and/or
66       modify it under the terms of the GNU General Public License as
67       published by the Free Software Foundation; either version 3, or (at
68       your option) any later version.
69
70       Perl-Critic-Pulp is distributed in the hope that it will be useful, but
71       WITHOUT ANY WARRANTY; without even the implied warranty of
72       MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
73       General Public License for more details.
74
75       You should have received a copy of the GNU General Public License along
76       with Perl-Critic-Pulp.  If not, see <http://www.gnu.org/licenses/>.
77
78
79
80perl v5.34.0            Perl::Crit2i0c2:1:-P0o7l-i2c2y::Miscellanea::TextDomainUnused(3)
Impressum