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

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