Manual Reference Pages - PERL::CRITIC::POLICY::COMPATIBILITY::GTK2CONSTANTS (3)
Perl::Critic::Policy::Compatibility::Gtk2Constants - new enough Gtk2 version for its constants
This policy is part of the Perl::Critic::Pulp
add-on. It requires that if you use certain constant subs from
Gtk2 and Glib then you must explicitly have a use
of a high enough version of those modules.
use Gtk2 1.160;
... return Gtk2::EVENT_PROPAGATE; # bad
use Gtk2 1.200 :constants;
... return GDK_CURRENT_TIME; # good
The following Gtk2 constants are checked,
GTK_PRIORITY_RESIZE # new in Gtk2 1.200 (devel 1.190)
EVENT_PROPAGATE # new in Gtk2 1.220 (devel 1.210)
GTK_PATH_PRIO_LOWEST # new in Gtk2 1.220 (devel 1.211)
and the following Glib constants
SOURCE_CONTINUE # new in Glib 1.220 (devel 1.210)
The idea is to keep you from using the constants without a new enough
Gtk2 or Glib. Of course theres a huge number of other things you
might do that also require a new enough version, but these constants tripped
me up a few times.
The exact version numbers above and demanded are development versions.
Youre probably best off rounding up to a stable one like 1.200 or 1.220.
As always if you dont care about this and in particular if for instance you
only ever use Gtk2 1.220 or higher anyway then you can disable
Gtk2Constants from your .perlcriticrc in the usual way (see
CONFIGURATION in Perl::Critic),
Constants are recognised as any of for instance
When theres a class name given its checked, so that other uses of say
EVENT_PROPAGATE arent picked up.
Some::Other::Thing::EVENT_PROPAGATE # ok
Some::Other::Thing->EVENT_PROPAGATE # ok
&Some::Other::Thing::EVENT_PROPAGATE # ok
When theres no class name, then its only assumed to be Gtk2 or Glib when
the respective module has been included.
EVENT_PROPAGATE # ok
use Gtk2 :constants;
EVENT_PROPAGATE # bad
In the latter form theres no check for :constants or explicit import in
the use, its assumed that if youve used Gtk2 then EVENT_PROPAGATE
means that one no matter how the imports might be arranged.
Perl::Critic::Pulp, Perl::Critic, Gtk2, Glib
Copyright 2008, 2009, 2010, 2011, 2012, 2013, 2014, 2015 Kevin Ryde
Perl-Critic-Pulp is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the Free
Software Foundation; either version 3, or (at your option) any later
Perl-Critic-Pulp is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
You should have received a copy of the GNU General Public License along with
Perl-Critic-Pulp. If not, see <http://www.gnu.org/licenses/>.
|perl v5.20.3 ||PERL::CRITIC::POLICY::COMPATIBILITY::GTK2CONSTANTS (3) ||2015-01-04 |
Visit the GSP FreeBSD Man Page Interface.
Output converted with manServer 1.07.