Skip to content

Commit 6c70269

Browse files
committed
Documentation render change, add POD::Checker testing the syntax
1 parent 65e3cb7 commit 6c70269

3 files changed

Lines changed: 35 additions & 6 deletions

File tree

Changes

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ unreleased
1111
- accept HTTP::Response subclasses (content/is_success branches stayed in sync)
1212
documentation:
1313
- document http=>1 and ua=>$ua parameters of new()
14+
- restructure geocode() Supported/Not Supported sections into proper =head3/=over blocks
1415
- We documented user-agent string as "Geo::Coder::OpenCage/$VERSION" but in code it
1516
used space as delimiter. It's also set when another UA is supplied in new() as
1617
documented.
@@ -22,6 +23,7 @@ unreleased
2223
- new tests for JSON decoding and API-key masking
2324
- new test for HTTP::Response subclasses
2425
- new tests for reverse geocoding calling without required parameters (lat,lng)
26+
- test the Perl documentation (POD) syntax
2527
release tooling:
2628
- abort (die) instead of warn on untracked files
2729
- .gitignore: drop dead entries, ignore dotted dirs except .github

lib/Geo/Coder/OpenCage.pm

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -258,16 +258,16 @@ L<OpenCage geocoding API response codes|https://opencagedata.com/api#codes>
258258
}
259259
260260
261-
=over
262-
263-
=item Supported Parameters
261+
=head3 Supported Parameters
264262
265263
The OpenCage Geocoder has a few optional parameters.
266264
267265
Please see L<the OpenCage geocoder documentation|https://opencagedata.com/api>. Most of L<the various optional parameters|https://opencagedata.com/api#forward-opt> are supported.
268266
269267
The most commonly useful parameters are:
270268
269+
=over
270+
271271
=item language
272272
273273
An IETF format language code (such as es for Spanish or pt-BR for Brazilian
@@ -285,6 +285,8 @@ the supplied country.
285285
286286
The countrycode is a comma separated list of 2 character code as defined by the ISO 3166-1 Alpha 2 standard.
287287
288+
=back
289+
288290
As a full example:
289291
290292
my $response = $Geocoder->geocode(
@@ -293,18 +295,19 @@ As a full example:
293295
countrycode => "ru",
294296
);
295297
298+
=head3 Not Supported
296299
297-
=item Not Supported
300+
=over
298301
299302
=item jsonp
300303
301304
This module always parses the response as a Perl data structure, so the jsonp
302305
option is never used.
303306
304-
All other API parameters are passed through directly
305-
306307
=back
307308
309+
All other API parameters are passed through directly.
310+
308311
=head2 reverse_geocode
309312
310313
Takes two named parameters 'lat' and 'lng' and returns a result hashref.

t/12-pod.t

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
use strict;
2+
use warnings;
3+
use Test::More;
4+
use Pod::Checker;
5+
6+
use lib './lib'; # actually use the module, not other versions installed
7+
8+
my @files = ('lib/Geo/Coder/OpenCage.pm');
9+
10+
for my $file (@files) {
11+
# Capture Pod::Checker's diagnostic output so test output stays clean,
12+
# and we can diag() it on failure.
13+
my $output = '';
14+
open my $fh, '>', \$output or die "open scalar: $!";
15+
16+
my $checker = Pod::Checker->new();
17+
$checker->parse_from_file($file, $fh);
18+
close $fh;
19+
20+
is($checker->num_errors, 0, "$file: POD has no errors")
21+
or diag($output);
22+
}
23+
24+
done_testing();

0 commit comments

Comments
 (0)