File Coverage

lib/Path/IsDev/Heuristic/MYMETA.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 5     5   6754 use 5.008; # utf8
  5         19  
  5         216  
2 5     5   27 use strict;
  5         10  
  5         161  
3 5     5   26 use warnings;
  5         11  
  5         155  
4 5     5   1400 use utf8;
  5         21  
  5         33  
5              
6             package Path::IsDev::Heuristic::MYMETA;
7              
8             our $VERSION = '1.001002';
9              
10             # ABSTRACT: Determine if a path contains MYMETA.(json|yml)
11              
12             our $AUTHORITY = 'cpan:KENTNL'; # AUTHORITY
13              
14              
15              
16              
17              
18              
19              
20              
21              
22              
23              
24              
25              
26              
27              
28              
29 5     5   1489 use Role::Tiny::With qw( with );
  5         14670  
  5         1335  
30             with 'Path::IsDev::Role::Heuristic', 'Path::IsDev::Role::Matcher::Child::Exists::Any::File';
31              
32              
33              
34              
35              
36              
37              
38              
39              
40              
41             sub files {
42 4     4 1 22 return qw( MYMETA.json MYMETA.yml );
43             }
44              
45              
46              
47              
48              
49              
50              
51             sub matches {
52 4     4 1 10 my ( $self, $result_object ) = @_;
53 4 100       13 if ( $self->child_exists_any_file( $result_object, $self->files ) ) {
54 1         20 $result_object->result(1);
55 1         7 return 1;
56             }
57 3         18 return;
58             }
59              
60             1;
61              
62             __END__
63              
64             =pod
65              
66             =encoding UTF-8
67              
68             =head1 NAME
69              
70             Path::IsDev::Heuristic::MYMETA - Determine if a path contains MYMETA.(json|yml)
71              
72             =head1 VERSION
73              
74             version 1.001002
75              
76             =head1 DESCRIPTION
77              
78             This heuristic is intended as a guarantee that B<SOME> kind of top level marker will
79             be present in a distribution, as all the main tool-chains emit this file during C<configure>.
80              
81             Granted, this heuristic is expected to be B<never> needed, as in order to create such a file, you first need a C<Build.PL>/C<Makefile.PL> to generate it.
82              
83             =head1 METHODS
84              
85             =head2 C<files>
86              
87             Files relevant to this heuristic
88              
89             MYMETA.json
90             MYMETA.yml
91              
92             =head2 C<matches>
93              
94             Matches if any of the files in C<files> exist as children of the C<path>
95              
96             =begin MetaPOD::JSON v1.1.0
97              
98             {
99             "namespace":"Path::IsDev::Heuristic::MYMETA",
100             "interface":"single_class",
101             "does":[
102             "Path::IsDev::Role::Heuristic",
103             "Path::IsDev::Role::Matcher::Child::Exists::Any::File"
104             ]
105             }
106              
107              
108             =end MetaPOD::JSON
109              
110             =head1 AUTHOR
111              
112             Kent Fredric <kentfredric@gmail.com>
113              
114             =head1 COPYRIGHT AND LICENSE
115              
116             This software is copyright (c) 2014 by Kent Fredric <kentfredric@gmail.com>.
117              
118             This is free software; you can redistribute it and/or modify it under
119             the same terms as the Perl 5 programming language system itself.
120              
121             =cut