1Perl::Critic::Policy::CUosmeprPaetCriolbn:it:lrCiirtbiyut:ti:ecGd:t:kPP2eoCrlolincsDyto:ac:nuCtmosem(np3ta)attiiboinlity::Gtk2Constants(3)
2
3
4

NAME

6       Perl::Critic::Policy::Compatibility::Gtk2Constants - new enough Gtk2
7       version for its constants
8

DESCRIPTION

10       This policy is part of the "Perl::Critic::Pulp" add-on.  It requires
11       that if you use certain constant subs from "Gtk2" and "Glib" then you
12       must explicitly have a "use" of a high enough version of those modules.
13
14           use Gtk2 1.160;
15           ... return Gtk2::EVENT_PROPAGATE;  # bad
16
17           use Gtk2 1.200 ':constants';
18           ... return GDK_CURRENT_TIME;       # good
19
20       The following "Gtk2" constants are checked,
21
22           GTK_PRIORITY_RESIZE       # new in Gtk2 1.200 (devel 1.190)
23           GDK_PRIORITY_EVENTS
24           GDK_PRIORITY_REDRAW
25           GDK_CURRENT_TIME
26
27           EVENT_PROPAGATE           # new in Gtk2 1.220 (devel 1.210)
28           EVENT_STOP
29
30           GTK_PATH_PRIO_LOWEST      # new in Gtk2 1.220 (devel 1.211)
31           GTK_PATH_PRIO_GTK
32           GTK_PATH_PRIO_APPLICATION
33           GTK_PATH_PRIO_THEME
34           GTK_PATH_PRIO_RC
35           GTK_PATH_PRIO_HIGHEST
36
37       and the following "Glib" constants
38
39           SOURCE_CONTINUE           # new in Glib 1.220 (devel 1.210)
40           SOURCE_REMOVE
41
42       The idea is to keep you from using the constants without a new enough
43       "Gtk2" or "Glib".  Of course there's a huge number of other things you
44       might do that also require a new enough version, but these constants
45       tripped me up a few times.
46
47       The exact version numbers above and demanded are development versions.
48       You're probably best off rounding up to a "stable" one like 1.200 or
49       1.220.
50
51       As always if you don't care about this and in particular if for
52       instance you only ever use Gtk2 1.220 or higher anyway then you can
53       disable "Gtk2Constants" from your .perlcriticrc in the usual way (see
54       "CONFIGURATION" in Perl::Critic),
55
56           [-Compatibility::Gtk2Constants]
57
58   Constant Forms
59       Constants are recognised as any of for instance
60
61           EVENT_PROPAGATE
62           Gtk2::EVENT_PROPAGATE
63           Gtk2->EVENT_PROPAGATE
64           &EVENT_PROPAGATE
65           &Gtk2::EVENT_PROPAGATE
66
67       When there's a class name given it's checked, so that other uses of say
68       "EVENT_PROPAGATE" aren't picked up.
69
70           Some::Other::Thing::EVENT_PROPAGATE      # ok
71           Some::Other::Thing->EVENT_PROPAGATE      # ok
72           &Some::Other::Thing::EVENT_PROPAGATE     # ok
73
74       When there's no class name, then it's only assumed to be Gtk2 or Glib
75       when the respective module has been included.
76
77           use Something::Else;
78           EVENT_PROPAGATE           # ok
79
80           use Gtk2 ':constants';
81           EVENT_PROPAGATE           # bad
82
83       In the latter form there's no check for ":constants" or explicit import
84       in the "use", it's assumed that if you've used Gtk2 then
85       "EVENT_PROPAGATE" means that one no matter how the imports might be
86       arranged.
87

SEE ALSO

89       Perl::Critic::Pulp, Perl::Critic, Gtk2, Glib
90

HOME PAGE

92       <http://user42.tuxfamily.org/perl-critic-pulp/index.html>
93
95       Copyright 2008, 2009, 2010, 2011, 2012, 2013, 2014, 2015, 2016, 2017,
96       2019, 2021 Kevin Ryde
97
98       Perl-Critic-Pulp is free software; you can redistribute it and/or
99       modify it under the terms of the GNU General Public License as
100       published by the Free Software Foundation; either version 3, or (at
101       your option) any later version.
102
103       Perl-Critic-Pulp is distributed in the hope that it will be useful, but
104       WITHOUT ANY WARRANTY; without even the implied warranty of
105       MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
106       General Public License for more details.
107
108       You should have received a copy of the GNU General Public License along
109       with Perl-Critic-Pulp.  If not, see <http://www.gnu.org/licenses/>.
110
111
112
113perl v5.32.1             Perl::Cri2t0i2c1:-:0P3o-l0i1cy::Compatibility::Gtk2Constants(3)
Impressum