File Coverage

inc/My/Module/Meta.pm
Criterion Covered Total %
statement 11 57 19.3
branch 0 12 0.0
condition 0 3 0.0
subroutine 4 23 17.3
pod 18 18 100.0
total 33 113 29.2


line stmt bran cond sub pod time code
1             package My::Module::Meta;
2              
3 1     1   26 use 5.008;
  1         4  
4              
5 1     1   7 use strict;
  1         1  
  1         39  
6 1     1   6 use warnings;
  1         2  
  1         45  
7              
8 1     1   6 use Carp;
  1         2  
  1         5186  
9              
10             sub new {
11 0     0 1   my ( $class ) = @_;
12 0 0         ref $class and $class = ref $class;
13             my $self = {
14             distribution => $ENV{MAKING_MODULE_DISTRIBUTION},
15 0           };
16 0           bless $self, $class;
17 0           return $self;
18             }
19              
20             sub abstract {
21 0     0 1   return 'Test POD links';
22             }
23              
24             sub add_to_cleanup {
25 0     0 1   return [ qw{ cover_db xt/author/optionals } ];
26             }
27              
28             sub author {
29 0     0 1   return 'Thomas R. Wyant, III F';
30             }
31              
32             sub build_requires {
33             return +{
34 0     0 1   'Test::More' => 0.88, # Because of done_testing().
35             };
36             }
37              
38             sub configure_requires {
39             return +{
40 0     0 1   'lib' => 0,
41             'strict' => 0,
42             'warnings' => 0,
43             };
44             }
45              
46             sub dist_name {
47 0     0 1   return 'Test-Pod-LinkCheck-Lite';
48             }
49              
50             sub distribution {
51 0     0 1   my ( $self ) = @_;
52 0           return $self->{distribution};
53             }
54              
55             sub license {
56 0     0 1   return 'perl';
57             }
58              
59             sub meta_merge {
60 0     0 1   my ( undef, @extra ) = @_;
61             return {
62 0           'meta-spec' => {
63             version => 2,
64             },
65             dynamic_config => 1,
66             resources => {
67             bugtracker => {
68             web => 'https://rt.cpan.org/Public/Dist/Display.html?Name=Test-Pod-LinkCheck-Lite',
69             # web => 'https://github.com/trwyant/perl-Test-Pod-LinkCheck-Lite/issues',
70             mailto => 'wyant@cpan.org',
71             },
72             license => 'http://dev.perl.org/licenses/',
73             repository => {
74             type => 'git',
75             url => 'git://github.com/trwyant/perl-Test-Pod-LinkCheck-Lite.git',
76             web => 'https://github.com/trwyant/perl-Test-Pod-LinkCheck-Lite',
77             },
78             },
79             @extra,
80             };
81             }
82              
83             sub module_name {
84 0     0 1   return 'Test::Pod::LinkCheck::Lite';
85             }
86              
87             sub no_index {
88             return +{
89 0     0 1   directory => [ qw{ inc t xt } ],
90             package => [ qw{ My_Parser } ],
91             };
92             }
93              
94             sub provides {
95 0     0 1   my $provides;
96 0           local $@ = undef;
97              
98 0 0         eval {
99 0           require CPAN::Meta;
100 0           require ExtUtils::Manifest;
101 0           require Module::Metadata;
102              
103 0           my $manifest;
104             {
105 0     0     local $SIG{__WARN__} = sub {};
  0            
106 0           $manifest = ExtUtils::Manifest::maniread();
107             }
108 0 0         keys %{ $manifest || {} }
  0 0          
109             or return;
110              
111             # Skeleton so we can use should_index_file() and
112             # should_index_package().
113 0           my $meta = CPAN::Meta->new( {
114             name => 'Euler',
115             version => 2.71828,
116             no_index => no_index(),
117             },
118             );
119              
120             # The Module::Metadata docs say not to use
121             # package_versions_from_directory() directly, but the 'files =>'
122             # version of provides() is broken, and has been known to be so
123             # since 2014, so it's not getting fixed any time soon. So:
124              
125 0           foreach my $fn ( sort keys %{ $manifest } ) {
  0            
126 0 0         $fn =~ m/ [.] pm \z /smx
127             or next;
128 0           my $pvd = Module::Metadata->package_versions_from_directory(
129             undef, [ $fn ] );
130 0           foreach my $pkg ( keys %{ $pvd } ) {
  0            
131             $meta->should_index_package( $pkg )
132             and $meta->should_index_file( $pvd->{$pkg}{file} )
133 0 0 0       and $provides->{$pkg} = $pvd->{$pkg};
134             }
135             }
136              
137 0           1;
138             } or return;
139              
140 0           return ( provides => $provides );
141             }
142              
143             sub optional_modules {
144 0     0 1   return ( qw{ IO::Socket::SSL Net::SSLeay } );
145             }
146              
147             sub requires {
148 0     0 1   my ( $self, @extra ) = @_;
149             ## if ( ! $self->distribution() ) {
150             ## }
151             return +{
152 0           'B::Keywords' => 0,
153             'Carp' => 0,
154             'Exporter' => 0,
155             'File::Find' => 0,
156             'File::Spec' => 0,
157             'HTTP::Tiny' => 0,
158             'IPC::Cmd' => 0,
159             'Module::Load::Conditional' => 0,
160             'Pod::Perldoc' => 0,
161             'Pod::Simple' => 0,
162             'Pod::Simple::LinkSection' => 0,
163             'Pod::Simple::PullParser' => 0,
164             'Storable' => 0,
165             'Test::Builder' => 0,
166             constant => 0,
167             strict => 0,
168             utf8 => 0,
169             warnings => 0,
170             @extra,
171             };
172             }
173              
174             sub requires_perl {
175 0     0 1   return 5.008;
176             }
177              
178             sub script_files {
179             return [
180 0     0 1   ];
181             }
182              
183             sub version_from {
184 0     0 1   return 'lib/Test/Pod/LinkCheck/Lite.pm';
185             }
186              
187             1;
188              
189             __END__