File Coverage

blib/lib/Perl/Critic/PolicyParameter/Behavior/String.pm
Criterion Covered Total %
statement 23 23 100.0
branch 2 2 100.0
condition n/a
subroutine 7 7 100.0
pod 1 1 100.0
total 33 33 100.0


line stmt bran cond sub pod time code
1             package Perl::Critic::PolicyParameter::Behavior::String;
2              
3 40     40   745 use 5.010001;
  40         157  
4 40     40   229 use strict;
  40         91  
  40         2247  
5 40     40   204 use warnings;
  40         105  
  40         988  
6              
7 40     40   1489 use Perl::Critic::Utils;
  40         1342  
  40         635  
8              
9 40     40   34448 use parent qw{ Perl::Critic::PolicyParameter::Behavior };
  40         93  
  40         1730  
10              
11             our $VERSION = '1.150';
12              
13             #-----------------------------------------------------------------------------
14              
15             sub _parse {
16 1106     1106   2522 my ($policy, $parameter, $config_string) = @_;
17              
18 1106         2905 my $value = $parameter->get_default_string();
19              
20 1106 100       2830 if ( defined $config_string ) {
21 27         67 $value = $config_string;
22             }
23              
24 1106         3784 $policy->__set_parameter_value($parameter, $value);
25              
26 1106         2261 return;
27             }
28              
29             #-----------------------------------------------------------------------------
30              
31             sub initialize_parameter {
32 2298     2298 1 5375 my ($self, $parameter, $specification) = @_;
33              
34 2298         7844 $parameter->_set_parser(\&_parse);
35              
36 2298         4898 return;
37             }
38              
39             #-----------------------------------------------------------------------------
40              
41             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 :