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