blib/lib/Perl/Critic/PolicyParameter/Behavior/Boolean.pm

filter: Statementstmt 100% 23 / 23 Branchbran 100% 2 / 2 Conditioncond 100% 3 / 3 MC/DCmcdc 100% 2 / 2 Subroutinesub 100% 7 / 7 Podpod 100% 1 / 1 totaltotal 100% 38 / 38 CC 3 SCAR 5.1
CC
3
Cov
100%
_parse
3.0
BEGIN
1.0
BEGIN
1.0
CRAP 1.7
« blib/lib/Perl/Critic/ProfilePrototype.pm ↑ Summary blib/lib/Perl/Critic/Policy/RegularExpressions/ProhibitUnusualDelimiters.pm »
1 package Perl::Critic::PolicyParameter::Behavior::Boolean;
2  
3 40 ▶use 5.010001;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 40 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 40 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
6 40 ▶use Perl::Critic::Utils;
Subroutine BEGIN: called CC=1 SCAR=0.0
7  
8 40 ▶use parent qw{ Perl::Critic::PolicyParameter::Behavior };
Subroutine BEGIN: called CC=1 SCAR=0.0
9  
10 40 our $VERSION = '1.150';
11  
12 #-----------------------------------------------------------------------------
13  
14 sub _parse {
15 1905 ▶ my ($policy, $parameter, $config_string) = @_;
Subroutine _parse: called CC=3 SCAR=11.0
16  
17 1905 ▶ my $value_string = $config_string // $parameter->get_default_string();
Condition100%3/3
$config_string // $parameter->get_default_string
l!l&&r!l&&!r
483611496
MC/DC100%2/2
$config_string // $parameter->get_default_string
$config_string $parameter->get_default_string
Truth table100%3/3
A // B
A= $config_stringB= $parameter->get_default_string
ABresult
1X1
011
000
18  
19 1905 ▶ $policy->__set_parameter_value($parameter, $value_string ? $TRUE : $FALSE);
Branch: 1 branch
BranchTrueFalseTotal
$value_string ? : 372 1533 1905
20  
21 1905 return;
22 }
23  
24 #-----------------------------------------------------------------------------
25  
26 sub initialize_parameter {
27 1920 ▶ my ($self, $parameter, $specification) = @_;
Subroutine initialize_parameter: called CC=1 SCAR=0.0
Pod documented
28  
29 1920 $parameter->_set_parser(\&_parse);
30  
31 1920 return;
32 }
33  
34 #-----------------------------------------------------------------------------
35  
36 40 1;
37  
38 __END__
39  
40 #-----------------------------------------------------------------------------
41  
42 =pod
43  
44 =for stopwords
45  
46 =head1 NAME
47  
48 Perl::Critic::PolicyParameter::Behavior::Boolean - Actions appropriate for a boolean parameter.
49  
50  
51 =head1 DESCRIPTION
52  
53 Provides a standard set of functionality for a boolean
54 L<Perl::Critic::PolicyParameter|Perl::Critic::PolicyParameter> so that
55 the developer of a policy does not have to provide it her/himself.
56  
57 NOTE: Do not instantiate this class. Use the singleton instance held
58 onto by
59 L<Perl::Critic::PolicyParameter|Perl::Critic::PolicyParameter>.
60  
61  
62 =head1 INTERFACE SUPPORT
63  
64 This is considered to be a non-public class. Its interface is subject
65 to change without notice.
66  
67  
68 =head1 METHODS
69  
70 =over
71  
72 =item C<initialize_parameter( $parameter, $specification )>
73  
74 Plug in the functionality this behavior provides into the parameter.
75 At present, this behavior isn't customizable by the specification.
76  
77  
78 =back
79  
80  
81 =head1 AUTHOR
82  
83 Elliot Shank <perl@galumph.com>
84  
85  
86 =head1 COPYRIGHT
87  
88 Copyright (c) 2006-2011 Elliot Shank.
89  
90 This program is free software; you can redistribute it and/or modify
91 it under the same terms as Perl itself. The full text of this license
92 can be found in the LICENSE file included with this module.
93  
94 =cut
95  
96 # Local Variables:
97 # mode: cperl
98 # cperl-indent-level: 4
99 # fill-column: 78
100 # indent-tabs-mode: nil
101 # c-indentation-style: bsd
102 # End:
103 # ex: set ts=8 sts=4 sw=4 tw=78 ft=perl expandtab shiftround :
« blib/lib/Perl/Critic/ProfilePrototype.pm ↑ Summary blib/lib/Perl/Critic/Policy/RegularExpressions/ProhibitUnusualDelimiters.pm »