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   22 use 5.008;
  1         3  
4              
5 1     1   10 use strict;
  1         1  
  1         17  
6 1     1   2 use warnings;
  1         2  
  1         29  
7              
8 1     1   3 use Carp;
  1         1  
  1         775  
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 'Get elevation data from the USGS';
22             }
23              
24             sub add_to_cleanup {
25 0     0 1   return [ qw{ cover_db } ];
26             }
27              
28             sub author {
29 0     0 1   return 'Tom Wyant (harryfmudd at comcast dot net)';
30             }
31              
32             sub configure_requires {
33             return +{
34 0     0 1   'lib' => 0,
35             'strict' => 0,
36             'warnings' => 0,
37             };
38             }
39              
40             sub dist_name {
41 0     0 1   return 'Geo-WebService-Elevation-USGS';
42             }
43              
44             sub distribution {
45 0     0 1   my ( $self ) = @_;
46 0           return $self->{distribution};
47             }
48              
49             sub license {
50 0     0 1   return 'perl';
51             }
52              
53             sub meta_merge {
54 0     0 1   my ( undef, @extra ) = @_;
55             return {
56 0           'meta-spec' => {
57             version => 2,
58             },
59             dynamic_config => 1,
60             resources => {
61             bugtracker => {
62             web => 'https://github.com/trwyant/perl-Geo-WebService-Elevation-USGS/issues',
63             mailto => 'harryfmudd@comcast.net',
64             },
65             license => 'http://dev.perl.org/licenses/',
66             repository => {
67             type => 'git',
68             url => 'git://github.com/trwyant/perl-Geo-WebService-Elevation-USGS.git',
69             web => 'https://github.com/trwyant/perl-Geo-WebService-Elevation-USGS',
70             },
71             },
72             @extra,
73             };
74             }
75              
76             sub module_name {
77 0     0 1   return 'Geo::WebService::Elevation::USGS';
78             }
79              
80             sub no_index {
81             return +{
82 0     0 1   directory => [ qw{ eg inc t xt } ],
83             };
84             }
85              
86             sub optional_modules {
87             # return ( qw{ Time::HiRes } );
88             # As of Test::Builder 1.302190 (March 2 2022) Time::HiRes is needed
89 0     0 1   return;
90             }
91              
92             sub provides {
93 0     0 1   my $provides;
94 0           local $@ = undef;
95              
96 0 0         eval {
97 0           require CPAN::Meta;
98 0           require ExtUtils::Manifest;
99 0           require Module::Metadata;
100              
101 0           my $manifest;
102             {
103 0     0     local $SIG{__WARN__} = sub {};
  0            
104 0           $manifest = ExtUtils::Manifest::maniread();
105             }
106 0 0         keys %{ $manifest || {} }
  0 0          
107             or return;
108              
109             # Skeleton so we can use should_index_file() and
110             # should_index_package().
111 0           my $meta = CPAN::Meta->new( {
112             name => 'Euler',
113             version => 2.71828,
114             no_index => no_index(),
115             },
116             );
117              
118             # The Module::Metadata docs say not to use
119             # package_versions_from_directory() directly, but the 'files =>'
120             # version of provides() is broken, and has been known to be so
121             # since 2014, so it's not getting fixed any time soon. So:
122              
123 0           foreach my $fn ( sort keys %{ $manifest } ) {
  0            
124 0 0         $fn =~ m/ [.] pm \z /smx
125             or next;
126 0           my $pvd = Module::Metadata->package_versions_from_directory(
127             undef, [ $fn ] );
128 0           foreach my $pkg ( keys %{ $pvd } ) {
  0            
129             $meta->should_index_package( $pkg )
130             and $meta->should_index_file( $pvd->{$pkg}{file} )
131 0 0 0       and $provides->{$pkg} = $pvd->{$pkg};
132             }
133             }
134              
135 0           1;
136             } or return;
137              
138 0           return ( provides => $provides );
139             }
140              
141             sub requires {
142 0     0 1   my ( undef, @extra ) = @_; # Invocant unused
143             ## if ( ! $self->distribution() ) {
144             ## }
145             return {
146 0           'Carp' => 0,
147             'HTTP::Request::Common' => 0,
148             'HTTP::Status' => 0,
149             'JSON' => 0,
150             'LWP::Protocol::https' => 0,
151             'LWP::UserAgent' => 0,
152             'Scalar::Util' => 1.10,
153             constant => 0,
154             strict => 0,
155             warnings => 0,
156             @extra,
157             };
158             }
159              
160             sub requires_perl {
161 0     0 1   return 5.008;
162             }
163              
164             sub build_requires {
165             return {
166 0     0 1   'Test::More' => 0.88,
167             'HTTP::Response' => 0,
168             };
169             }
170              
171             sub script_files {
172             return [
173 0     0 1   ];
174             }
175              
176             sub version_from {
177 0     0 1   return 'lib/Geo/WebService/Elevation/USGS.pm';
178             }
179              
180             1;
181              
182             __END__