« blib/lib/Perl/Critic/Policy/Modules/RequireBarewordIncludes.pm
↑ Summary
blib/lib/Perl/Critic/Policy/ControlStructures/ProhibitCStyleForLoops.pm »
| 1 | package Perl::Critic::Exception::Configuration::Option; | ||
| 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 | our $VERSION = '1.150'; | |
| 8 | |||
| 9 | #----------------------------------------------------------------------------- | ||
| 10 | |||
| 11 | 40 | ▶ | use Perl::Critic::Exception::Fatal::Internal; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 12 | |||
| 13 | use Exception::Class ( # this must come after "use P::C::Exception::*" | ||
| 14 | 40 | '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 | ▶ | ); |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 20 | |||
| 21 | #----------------------------------------------------------------------------- | ||
| 22 | |||
| 23 | sub message { | ||
| 24 | 0 | ▶ | my $self = shift; |
|
Subroutine
message: not called CC=1 SCAR=6.9
Pod
documented
| |||
| 25 | |||
| 26 | 0 | return $self->full_message(); | |
| 27 | } | ||
| 28 | |||
| 29 | #----------------------------------------------------------------------------- | ||
| 30 | |||
| 31 | sub error { | ||
| 32 | 0 | ▶ | my $self = shift; |
|
Subroutine
error: not called CC=1 SCAR=6.9
Pod
documented
| |||
| 33 | |||
| 34 | 0 | return $self->full_message(); | |
| 35 | } | ||
| 36 | |||
| 37 | #----------------------------------------------------------------------------- | ||
| 38 | |||
| 39 | ## no critic (Subroutines::RequireFinalReturn) | ||
| 40 | sub full_message { | ||
| 41 | 0 | ▶ | Perl::Critic::Exception::Fatal::Internal->throw( |
|
Subroutine
full_message: not called CC=1 SCAR=6.9
Pod
documented
| |||
| 42 | 'Subclass failed to override abstract method.' | ||
| 43 | ); | ||
| 44 | } | ||
| 45 | ## use critic | ||
| 46 | |||
| 47 | |||
| 48 | 40 | 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 : | ||