File Coverage

blib/lib/Form/Factory/Feature/Role/CustomMessage.pm
Criterion Covered Total %
statement 3 12 25.0
branch n/a
condition 0 9 0.0
subroutine 1 4 25.0
pod 3 3 100.0
total 7 28 25.0


line stmt bran cond sub pod time code
1             package Form::Factory::Feature::Role::CustomMessage;
2             $Form::Factory::Feature::Role::CustomMessage::VERSION = '0.022';
3 1     1   528 use Moose::Role;
  1         1  
  1         7  
4              
5             # ABSTRACT: features with custom messages
6              
7              
8             has message => (
9             is => 'ro',
10             isa => 'Str',
11             predicate => 'has_message',
12             );
13              
14              
15             sub feature_info {
16 0     0 1   my $self = shift;
17 0   0       my $message = $self->message || shift;
18 0           $self->result->info($message);
19             }
20              
21              
22             sub feature_warning {
23 0     0 1   my $self = shift;
24 0   0       my $message = $self->message || shift;
25 0           $self->result->warning($message);
26             }
27              
28              
29             sub feature_error {
30 0     0 1   my $self = shift;
31 0   0       my $message = $self->message || shift;
32 0           $self->result->error($message);
33             }
34              
35             1;
36              
37             __END__
38              
39             =pod
40              
41             =encoding UTF-8
42              
43             =head1 NAME
44              
45             Form::Factory::Feature::Role::CustomMessage - features with custom messages
46              
47             =head1 VERSION
48              
49             version 0.022
50              
51             =head1 DESCRIPTION
52              
53             A feature may consume this role in order to allow the user to specify a custom message on failure.
54              
55             =head1 ATTRIBUTES
56              
57             =head2 message
58              
59             This is a custom error message for failures. This message is used instead of the one the feature specifies when L</feature_info>, L</feature_warning>, and L</feature_error> are called.
60              
61             This is inadequate. It should be fixed in the future.
62              
63             =head1 METHODS
64              
65             =head2 feature_info
66              
67             $feature->feature_info($message);
68              
69             Record an info feature message.
70              
71             =head2 feature_warning
72              
73             $feature->feature_warning($message);
74              
75             Record a warning feature message.
76              
77             =head2 feature_error
78              
79             $feature->feature_error($message);
80              
81             Record an error feature message.
82              
83             =head1 AUTHOR
84              
85             Andrew Sterling Hanenkamp <hanenkamp@cpan.org>
86              
87             =head1 COPYRIGHT AND LICENSE
88              
89             This software is copyright (c) 2015 by Qubling Software LLC.
90              
91             This is free software; you can redistribute it and/or modify it under
92             the same terms as the Perl 5 programming language system itself.
93              
94             =cut