File Coverage

blib/lib/Perl/Critic/Exception/Configuration/Option.pm
Criterion Covered Total %
statement 14 19 73.6
branch n/a
condition n/a
subroutine 5 8 62.5
pod 3 3 100.0
total 22 30 73.3


line stmt bran cond sub pod time code
1             package Perl::Critic::Exception::Configuration::Option;
2              
3 40     40   25692 use 5.010001;
  40         154  
4 40     40   252 use strict;
  40         97  
  40         777  
5 40     40   187 use warnings;
  40         78  
  40         1852  
6              
7             our $VERSION = '1.150';
8              
9             #-----------------------------------------------------------------------------
10              
11 40     40   16219 use Perl::Critic::Exception::Fatal::Internal;
  40         99  
  40         2510  
12              
13             use Exception::Class ( # this must come after "use P::C::Exception::*"
14 40         333 'Perl::Critic::Exception::Configuration::Option' => {
15             isa => 'Perl::Critic::Exception::Configuration',
16             description => 'A problem with an option in the Perl::Critic configuration, whether from a file or a command line or some other source.',
17             fields => [ qw{ option_name option_value message_suffix } ],
18             },
19 40     40   296 );
  40         97  
20              
21             #-----------------------------------------------------------------------------
22              
23             sub message {
24 0     0 1   my $self = shift;
25              
26 0           return $self->full_message();
27             }
28              
29             #-----------------------------------------------------------------------------
30              
31             sub error {
32 0     0 1   my $self = shift;
33              
34 0           return $self->full_message();
35             }
36              
37             #-----------------------------------------------------------------------------
38              
39             ## no critic (Subroutines::RequireFinalReturn)
40             sub full_message {
41 0     0 1   Perl::Critic::Exception::Fatal::Internal->throw(
42             'Subclass failed to override abstract method.'
43             );
44             }
45             ## use critic
46              
47              
48             1;
49              
50             __END__
51              
52             #-----------------------------------------------------------------------------
53              
54             =pod
55              
56             =for stopwords
57              
58             =head1 NAME
59              
60             Perl::Critic::Exception::Configuration::Option - A problem with an option in the L<Perl::Critic|Perl::Critic> configuration.
61              
62             =head1 DESCRIPTION
63              
64             A representation of a problem found with an option in the
65             configuration of L<Perl::Critic|Perl::Critic>, whether from a
66             F<.perlcriticrc>, another profile file, or command line.
67              
68             This is an abstract class. It should never be instantiated.
69              
70              
71             =head1 INTERFACE SUPPORT
72              
73             This is considered to be a public class. Any changes to its interface
74             will go through a deprecation cycle.
75              
76              
77             =head1 METHODS
78              
79             =over
80              
81             =item C<option_name()>
82              
83             The name of the option that was found to be in error.
84              
85              
86             =item C<option_value()>
87              
88             The value of the option that was found to be in error.
89              
90              
91             =item C<message_suffix()>
92              
93             Any text that should be applied to end of the standard message for
94             this kind of exception.
95              
96              
97             =item C<message()>
98              
99             =item C<error()>
100              
101             Overridden to call C<full_message()>. I.e. any message string in the
102             superclass is ignored.
103              
104              
105             =item C<full_message()>
106              
107             Overridden to turn it into an abstract method to force subclasses to
108             implement it.
109              
110              
111             =back
112              
113              
114             =head1 SEE ALSO
115              
116             L<Perl::Critic::Exception::Configuration::Option::Global|Perl::Critic::Exception::Configuration::Option::Global>,
117             L<Perl::Critic::Exception::Configuration::Option::Policy|Perl::Critic::Exception::Configuration::Option::Policy>
118              
119              
120             =head1 AUTHOR
121              
122             Elliot Shank <perl@galumph.com>
123              
124             =head1 COPYRIGHT
125              
126             Copyright (c) 2007-2011 Elliot Shank.
127              
128             This program is free software; you can redistribute it and/or modify
129             it under the same terms as Perl itself. The full text of this license
130             can be found in the LICENSE file included with this module.
131              
132             =cut
133              
134             # Local Variables:
135             # mode: cperl
136             # cperl-indent-level: 4
137             # fill-column: 78
138             # indent-tabs-mode: nil
139             # c-indentation-style: bsd
140             # End:
141             # ex: set ts=8 sts=4 sw=4 tw=78 ft=perl expandtab shiftround :