File Coverage

blib/lib/Path/IsDev/Role/NegativeHeuristic.pm
Criterion Covered Total %
statement 22 22 100.0
branch 1 2 50.0
condition n/a
subroutine 8 8 100.0
pod 2 2 100.0
total 33 34 97.0


line stmt bran cond sub pod time code
1 15     15   79018 use 5.008; # utf8
  15         57  
  15         819  
2 15     15   101 use strict;
  15         26  
  15         518  
3 15     15   81 use warnings;
  15         27  
  15         398  
4 15     15   1256 use utf8;
  15         42  
  15         92  
5              
6             package Path::IsDev::Role::NegativeHeuristic;
7              
8             our $VERSION = '1.001002';
9              
10             # ABSTRACT: Base role for Negative Heuristic things.
11              
12             our $AUTHORITY = 'cpan:KENTNL'; # AUTHORITY
13              
14 80     80   504 sub _blessed { require Scalar::Util; goto &Scalar::Util::blessed }
  80         405  
15              
16 15     15   2924 use Role::Tiny qw( requires );
  15         4324  
  15         87  
17              
18              
19              
20              
21              
22              
23              
24              
25              
26              
27              
28              
29              
30              
31              
32              
33              
34              
35              
36              
37              
38              
39              
40              
41             sub name {
42 80     80 1 125 my $name = shift;
43 80 50       218 $name = _blessed($name) if _blessed($name);
44 80         380 $name =~ s/\APath::IsDev::NegativeHeuristic:/- :/msx;
45 80         249 return $name;
46             }
47              
48              
49              
50              
51              
52              
53              
54              
55              
56             sub heuristic_type {
57 80     80 1 197 return 'negative heuristic';
58             }
59              
60              
61              
62              
63              
64              
65              
66              
67              
68              
69              
70              
71              
72              
73              
74              
75              
76              
77              
78              
79              
80              
81             requires 'excludes';
82              
83             1;
84              
85             __END__
86              
87             =pod
88              
89             =encoding UTF-8
90              
91             =head1 NAME
92              
93             Path::IsDev::Role::NegativeHeuristic - Base role for Negative Heuristic things.
94              
95             =head1 VERSION
96              
97             version 1.001002
98              
99             =head1 ROLE REQUIRES
100              
101             =head2 C<excludes>
102              
103             Implementing classes must provide this method.
104              
105             return : 1 / undef
106             1 -> this path is not a development directory as far as this heuristic is concerned
107             undef -> this path is a development directory as far as this heuristic is concerned
108              
109             args : ( $class , $result_object )
110             $class -> method will be invoked on packages, not objects
111             $result_object -> will be a Path::IsDev::Result
112              
113             Additionally, consuming classes B<should> set C<< $result_object->result( undef ) >> prior to returning true.
114              
115             Composing roles B<should> also invoke C<< $result_object->add_reason( $self, $result_value, $descriptive_reason_for_result, \%contextinfo ) >>.
116              
117             See L<< C<Path::IsDev::Result> for details|Path::IsDev::Result >>
118              
119             =head1 METHODS
120              
121             =head2 C<name>
122              
123             Returns the name to use in debugging.
124              
125             By default, this is derived from the classes name
126             with the C<PIDNH> prefix removed:
127              
128             Path::IsDev::NegativeHeuristic::IsDev::IgnoreFile->name()
129             → "- ::IsDev::IgnoreFile"
130              
131             =head2 C<heuristic_type>
132              
133             Returns a description of the general heuristic type
134              
135             negative heuristic
136              
137             =begin MetaPOD::JSON v1.1.0
138              
139             {
140             "namespace":"Path::IsDev::Role::NegativeHeuristic",
141             "interface":"role"
142             }
143              
144              
145             =end MetaPOD::JSON
146              
147             =head1 AUTHOR
148              
149             Kent Fredric <kentfredric@gmail.com>
150              
151             =head1 COPYRIGHT AND LICENSE
152              
153             This software is copyright (c) 2014 by Kent Fredric <kentfredric@gmail.com>.
154              
155             This is free software; you can redistribute it and/or modify it under
156             the same terms as the Perl 5 programming language system itself.
157              
158             =cut