File Coverage

lib/Path/IsDev/Heuristic/TestDir.pm
Criterion Covered Total %
statement 21 21 100.0
branch 2 2 100.0
condition n/a
subroutine 7 7 100.0
pod 2 2 100.0
total 32 32 100.0


line stmt bran cond sub pod time code
1 7     7   14657 use 5.008; # utf8
  7         28  
  7         315  
2 7     7   43 use strict;
  7         14  
  7         244  
3 7     7   37 use warnings;
  7         16  
  7         211  
4 7     7   3326 use utf8;
  7         28  
  7         65  
5              
6             package Path::IsDev::Heuristic::TestDir;
7              
8             our $VERSION = '1.001002';
9              
10             # ABSTRACT: Determine if a path contains a t/ or xt/ directory
11              
12             our $AUTHORITY = 'cpan:KENTNL'; # AUTHORITY
13              
14              
15              
16              
17              
18              
19              
20              
21              
22              
23              
24              
25              
26              
27              
28              
29 7     7   2327 use Role::Tiny::With qw( with );
  7         6156  
  7         1473  
30              
31             with 'Path::IsDev::Role::Heuristic', 'Path::IsDev::Role::Matcher::Child::Exists::Any::Dir';
32              
33              
34              
35              
36              
37              
38              
39              
40              
41              
42             sub dirs {
43 6     6 1 43 return qw( xt t );
44             }
45              
46              
47              
48              
49              
50              
51              
52              
53              
54             sub matches {
55 6     6 1 23 my ( $self, $result_object ) = @_;
56 6 100       25 if ( $self->child_exists_any_dir( $result_object, $self->dirs ) ) {
57 1         25 $result_object->result(1);
58 1         10 return 1;
59             }
60 5         30 return;
61             }
62              
63             1;
64              
65             __END__
66              
67             =pod
68              
69             =encoding UTF-8
70              
71             =head1 NAME
72              
73             Path::IsDev::Heuristic::TestDir - Determine if a path contains a t/ or xt/ directory
74              
75             =head1 VERSION
76              
77             version 1.001002
78              
79             =head1 METHODS
80              
81             =head2 C<dirs>
82              
83             Directories relevant to this heuristic:
84              
85             t/
86             xt/
87              
88             =head2 C<matches>
89              
90             if ( $heuristic->matches( $result_object ) ) {
91             # one of the directories in ->dirs exists
92             }
93              
94             =begin MetaPOD::JSON v1.1.0
95              
96             {
97             "namespace":"Path::IsDev::Heuristic::TestDir",
98             "interface":"single_class",
99             "does":[
100             "Path::IsDev::Role::Heuristic",
101             "Path::IsDev::Role::Matcher::Child::Exists::Any::Dir"
102             ]
103             }
104              
105              
106             =end MetaPOD::JSON
107              
108             =head1 AUTHOR
109              
110             Kent Fredric <kentfredric@gmail.com>
111              
112             =head1 COPYRIGHT AND LICENSE
113              
114             This software is copyright (c) 2014 by Kent Fredric <kentfredric@gmail.com>.
115              
116             This is free software; you can redistribute it and/or modify it under
117             the same terms as the Perl 5 programming language system itself.
118              
119             =cut