| line | stmt | bran | cond | sub | pod | time | code | 
| 1 |  |  |  |  |  |  | use strict; | 
| 2 | 12 |  |  | 12 |  | 62 | use warnings; | 
|  | 12 |  |  |  |  | 17 |  | 
|  | 12 |  |  |  |  | 252 |  | 
| 3 | 12 |  |  | 12 |  | 44 | use Exporter 'import'; | 
|  | 12 |  |  |  |  | 18 |  | 
|  | 12 |  |  |  |  | 232 |  | 
| 4 | 12 |  |  | 12 |  | 43 |  | 
|  | 12 |  |  |  |  | 15 |  | 
|  | 12 |  |  |  |  | 273 |  | 
| 5 |  |  |  |  |  |  | use App::SpamcupNG::Warning; | 
| 6 | 12 |  |  | 12 |  | 3543 | use App::SpamcupNG::Warning::Yum; | 
|  | 12 |  |  |  |  | 23 |  | 
|  | 12 |  |  |  |  | 268 |  | 
| 7 | 12 |  |  | 12 |  | 3524 |  | 
|  | 12 |  |  |  |  | 27 |  | 
|  | 12 |  |  |  |  | 1399 |  | 
| 8 |  |  |  |  |  |  | our $VERSION = '0.015'; # VERSION | 
| 9 |  |  |  |  |  |  |  | 
| 10 |  |  |  |  |  |  | =head1 NAME | 
| 11 |  |  |  |  |  |  |  | 
| 12 |  |  |  |  |  |  | App::SpamcupNG::Warning::Factory - a factory design pattern to create warnings. | 
| 13 |  |  |  |  |  |  |  | 
| 14 |  |  |  |  |  |  | =head1 SYNOPSIS | 
| 15 |  |  |  |  |  |  |  | 
| 16 |  |  |  |  |  |  | use App::SpamcupNG::Warning::Factory qw(create_warning); | 
| 17 |  |  |  |  |  |  |  | 
| 18 |  |  |  |  |  |  |  | 
| 19 |  |  |  |  |  |  | =head1 DESCRIPTION | 
| 20 |  |  |  |  |  |  |  | 
| 21 |  |  |  |  |  |  | This is a factory to create warnings. | 
| 22 |  |  |  |  |  |  |  | 
| 23 |  |  |  |  |  |  | It should be used instead of creating new instances manually. | 
| 24 |  |  |  |  |  |  |  | 
| 25 |  |  |  |  |  |  | =cut | 
| 26 |  |  |  |  |  |  |  | 
| 27 |  |  |  |  |  |  | our @EXPORT_OK = qw(create_warning); | 
| 28 |  |  |  |  |  |  |  | 
| 29 |  |  |  |  |  |  | my $yum_regex = qr/^Yum/; | 
| 30 |  |  |  |  |  |  |  | 
| 31 |  |  |  |  |  |  | =head1 EXPORTS | 
| 32 |  |  |  |  |  |  |  | 
| 33 |  |  |  |  |  |  | Only C<create_warning> is exported by request. | 
| 34 |  |  |  |  |  |  |  | 
| 35 |  |  |  |  |  |  | =head1 FUNCTIONS | 
| 36 |  |  |  |  |  |  |  | 
| 37 |  |  |  |  |  |  | =head2 create_warning | 
| 38 |  |  |  |  |  |  |  | 
| 39 |  |  |  |  |  |  | Creates a new instance of App::SpamcupNG::Warning or one of it's subclasses. | 
| 40 |  |  |  |  |  |  |  | 
| 41 |  |  |  |  |  |  | Expects as parameters an array reference with the warning message lines. | 
| 42 |  |  |  |  |  |  |  | 
| 43 |  |  |  |  |  |  | Returns the instance. | 
| 44 |  |  |  |  |  |  |  | 
| 45 |  |  |  |  |  |  | =cut | 
| 46 |  |  |  |  |  |  |  | 
| 47 |  |  |  |  |  |  | my $message_ref = shift; | 
| 48 |  |  |  |  |  |  |  | 
| 49 | 2 |  |  | 2 | 1 | 5 | die 'message must be an array reference' | 
| 50 |  |  |  |  |  |  | unless ( ( ref($message_ref) eq 'ARRAY' ) | 
| 51 |  |  |  |  |  |  | and ( scalar( @{$message_ref} ) > 0 ) ); | 
| 52 |  |  |  |  |  |  |  | 
| 53 | 2 | 50 | 33 |  |  | 7 | return App::SpamcupNG::Warning::Yum->new($message_ref) | 
|  | 2 |  |  |  |  | 7 |  | 
| 54 |  |  |  |  |  |  | if ( $message_ref->[0] =~ $yum_regex ); | 
| 55 | 2 | 100 |  |  |  | 17 | return App::SpamcupNG::Warning->new($message_ref); | 
| 56 |  |  |  |  |  |  | } | 
| 57 | 1 |  |  |  |  | 10 |  | 
| 58 |  |  |  |  |  |  | =head1 AUTHOR | 
| 59 |  |  |  |  |  |  |  | 
| 60 |  |  |  |  |  |  | Alceu Rodrigues de Freitas Junior, E<lt>arfreitas@cpan.orgE<gt> | 
| 61 |  |  |  |  |  |  |  | 
| 62 |  |  |  |  |  |  | =head1 COPYRIGHT AND LICENSE | 
| 63 |  |  |  |  |  |  |  | 
| 64 |  |  |  |  |  |  | This software is copyright (c) 2018 of Alceu Rodrigues de Freitas Junior, | 
| 65 |  |  |  |  |  |  | E<lt>arfreitas@cpan.orgE<gt> | 
| 66 |  |  |  |  |  |  |  | 
| 67 |  |  |  |  |  |  | This file is part of App-SpamcupNG distribution. | 
| 68 |  |  |  |  |  |  |  | 
| 69 |  |  |  |  |  |  | App-SpamcupNG is free software: you can redistribute it and/or modify it under | 
| 70 |  |  |  |  |  |  | the terms of the GNU General Public License as published by the Free Software | 
| 71 |  |  |  |  |  |  | Foundation, either version 3 of the License, or (at your option) any later | 
| 72 |  |  |  |  |  |  | version. | 
| 73 |  |  |  |  |  |  |  | 
| 74 |  |  |  |  |  |  | App-SpamcupNG is distributed in the hope that it will be useful, but WITHOUT | 
| 75 |  |  |  |  |  |  | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS | 
| 76 |  |  |  |  |  |  | FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. | 
| 77 |  |  |  |  |  |  |  | 
| 78 |  |  |  |  |  |  | You should have received a copy of the GNU General Public License along with | 
| 79 |  |  |  |  |  |  | App-SpamcupNG. If not, see <http://www.gnu.org/licenses/>. | 
| 80 |  |  |  |  |  |  |  | 
| 81 |  |  |  |  |  |  | =cut | 
| 82 |  |  |  |  |  |  |  | 
| 83 |  |  |  |  |  |  | 1; |