Build all packages removed dependencies of libtest-exception-perl libtest-warn-perl...
[dh-make-perl] / dev / i386 / libperl-critic-perl / libperl-critic-perl-1.088 / lib / Perl / Critic / PolicyParameter / Behavior / String.pm
1 ##############################################################################
2 #      $URL: http://perlcritic.tigris.org/svn/perlcritic/trunk/Perl-Critic/lib/Perl/Critic/PolicyParameter/Behavior/String.pm $
3 #     $Date: 2008-07-03 10:19:10 -0500 (Thu, 03 Jul 2008) $
4 #   $Author: clonezone $
5 # $Revision: 2489 $
6 ##############################################################################
7
8 package Perl::Critic::PolicyParameter::Behavior::String;
9
10 use 5.006001;
11 use strict;
12 use warnings;
13
14 use Perl::Critic::Utils;
15
16 use base qw{ Perl::Critic::PolicyParameter::Behavior };
17
18 our $VERSION = '1.088';
19
20 #-----------------------------------------------------------------------------
21
22 sub _parse {
23     my ($policy, $parameter, $config_string) = @_;
24
25     my $name = $parameter->get_name();
26     my $value = $parameter->get_default_string();
27
28     if ( defined $config_string ) {
29         $value = $config_string;
30     }
31
32     $policy->__set_parameter_value($parameter, $value);
33
34     return;
35 }
36
37 #-----------------------------------------------------------------------------
38
39 sub initialize_parameter {
40     my ($self, $parameter, $specification) = @_;
41
42     $parameter->_set_parser(\&_parse);
43
44     return;
45 }
46
47 #-----------------------------------------------------------------------------
48
49 1;
50
51 __END__
52
53 #-----------------------------------------------------------------------------
54
55 =pod
56
57 =for stopwords
58
59 =head1 NAME
60
61 Perl::Critic::PolicyParameter::Behavior::String - Actions appropriate for a simple string parameter.
62
63
64 =head1 DESCRIPTION
65
66 Provides a standard set of functionality for a string
67 L<Perl::Critic::PolicyParameter> so that the developer of a policy
68 does not have to provide it her/himself.
69
70 NOTE: Do not instantiate this class.  Use the singleton instance held
71 onto by L<Perl::Critic::PolicyParameter>.
72
73
74 =head1 METHODS
75
76 =over
77
78 =item C<initialize_parameter( $parameter, $specification )>
79
80 Plug in the functionality this behavior provides into the parameter.
81 At present, this behavior isn't customizable by the specification.
82
83 =back
84
85
86 =head1 AUTHOR
87
88 Elliot Shank <perl@galumph.com>
89
90 =head1 COPYRIGHT
91
92 Copyright (c) 2007-2008 Elliot Shank.  All rights reserved.
93
94 This program is free software; you can redistribute it and/or modify
95 it under the same terms as Perl itself.  The full text of this license
96 can be found in the LICENSE file included with this module.
97
98 =cut
99
100 # Local Variables:
101 #   mode: cperl
102 #   cperl-indent-level: 4
103 #   fill-column: 78
104 #   indent-tabs-mode: nil
105 #   c-indentation-style: bsd
106 # End:
107 # ex: set ts=8 sts=4 sw=4 tw=78 ft=perl expandtab shiftround :