1use 5.008;    # utf8
2use strict;
3use warnings;
4use utf8;
5
6package Path::IsDev::Heuristic::TestDir;
7
8our $VERSION = '1.001002';
9
10# ABSTRACT: Determine if a path contains a t/ or xt/ directory
11
12our $AUTHORITY = 'cpan:KENTNL'; # AUTHORITY
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29use Role::Tiny::With qw( with );
30
31with 'Path::IsDev::Role::Heuristic', 'Path::IsDev::Role::Matcher::Child::Exists::Any::Dir';
32
33
34
35
36
37
38
39
40
41
42sub dirs {
43  return qw( xt t );
44}
45
46
47
48
49
50
51
52
53
54sub matches {
55  my ( $self, $result_object ) = @_;
56  if ( $self->child_exists_any_dir( $result_object, $self->dirs ) ) {
57    $result_object->result(1);
58    return 1;
59  }
60  return;
61}
62
631;
64
65__END__
66
67=pod
68
69=encoding UTF-8
70
71=head1 NAME
72
73Path::IsDev::Heuristic::TestDir - Determine if a path contains a t/ or xt/ directory
74
75=head1 VERSION
76
77version 1.001002
78
79=head1 METHODS
80
81=head2 C<dirs>
82
83Directories 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
110Kent Fredric <kentfredric@gmail.com>
111
112=head1 COPYRIGHT AND LICENSE
113
114This software is copyright (c) 2014 by Kent Fredric <kentfredric@gmail.com>.
115
116This is free software; you can redistribute it and/or modify it under
117the same terms as the Perl 5 programming language system itself.
118
119=cut
120