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) $
6 ##############################################################################
8 package Perl::Critic::PolicyParameter::Behavior::String;
14 use Perl::Critic::Utils;
16 use base qw{ Perl::Critic::PolicyParameter::Behavior };
18 our $VERSION = '1.088';
20 #-----------------------------------------------------------------------------
23 my ($policy, $parameter, $config_string) = @_;
25 my $name = $parameter->get_name();
26 my $value = $parameter->get_default_string();
28 if ( defined $config_string ) {
29 $value = $config_string;
32 $policy->__set_parameter_value($parameter, $value);
37 #-----------------------------------------------------------------------------
39 sub initialize_parameter {
40 my ($self, $parameter, $specification) = @_;
42 $parameter->_set_parser(\&_parse);
47 #-----------------------------------------------------------------------------
53 #-----------------------------------------------------------------------------
61 Perl::Critic::PolicyParameter::Behavior::String - Actions appropriate for a simple string parameter.
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.
70 NOTE: Do not instantiate this class. Use the singleton instance held
71 onto by L<Perl::Critic::PolicyParameter>.
78 =item C<initialize_parameter( $parameter, $specification )>
80 Plug in the functionality this behavior provides into the parameter.
81 At present, this behavior isn't customizable by the specification.
88 Elliot Shank <perl@galumph.com>
92 Copyright (c) 2007-2008 Elliot Shank. All rights reserved.
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.
102 # cperl-indent-level: 4
104 # indent-tabs-mode: nil
105 # c-indentation-style: bsd
107 # ex: set ts=8 sts=4 sw=4 tw=78 ft=perl expandtab shiftround :