You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: lib/Geo/Address/Formatter.pm
+48-15Lines changed: 48 additions & 15 deletions
Original file line number
Diff line number
Diff line change
@@ -78,11 +78,23 @@ Returns one instance. The I<conf_path> is required.
78
78
79
79
Optional parameters are:
80
80
81
-
I<debug>: prints tons of debugging info for use in development.
81
+
=over
82
82
83
-
I<no_warnings>: turns off a few warnings if configuration is not optimal.
83
+
=item* I<debug>
84
84
85
-
I<only_address>: formatted will only contain known components (will not include POI names). Note, can be overridden with optional param to format_address method.
85
+
Prints tons of debugging info for use in development.
86
+
87
+
=item* I<no_warnings>
88
+
89
+
Turns off a few warnings if configuration is not optimal.
90
+
91
+
=item* I<only_address>
92
+
93
+
Formatted output will only contain known address components (will not
94
+
include POI names). Can be overridden per-call via the I<only_address>
95
+
option to L</format_address>.
96
+
97
+
=back
86
98
87
99
=cut
88
100
@@ -363,9 +375,10 @@ sub _precompile_abbreviations {
363
375
364
376
my $rh_components = $GAF->final_components();
365
377
366
-
returns a reference to a hash of the final components that are set at the
367
-
completion of B<format_address>. Warns if called before they have been set
368
-
(unless I<no_warnings> was set at object creation).
378
+
Returns a reference to a hash of the final components that were set during
379
+
the most recent call to B<format_address>. Returns C<undef> if called
380
+
before B<format_address> has been called. Warns in that case unless
381
+
I<no_warnings> was set at object creation.
369
382
370
383
=cut
371
384
@@ -383,21 +396,32 @@ sub final_components {
383
396
my $text = $GAF->format_address(\%components, \%options );
384
397
385
398
Given structured address components (hashref) and options (hashref) returns a
386
-
formatted address (string).
399
+
formatted address as a multiline string with a trailing newline.
387
400
388
401
Possible options are:
389
402
390
-
'abbreviate', if supplied common abbreviations are applied
391
-
to the resulting output.
403
+
=over
404
+
405
+
=item* I<abbreviate>
406
+
407
+
If true, common abbreviations are applied to the resulting output.
408
+
409
+
=item* I<address_template>
392
410
393
-
'address_template', a mustache format template to be used instead of the template
394
-
defined in the configuration
411
+
A Mustache-format template to be used instead of the template defined in
412
+
the configuration.
395
413
396
-
'country', which should be an uppercase ISO 3166-1:alpha-2 code
397
-
e.g. 'GB' for Great Britain, 'DE' for Germany, etc.
398
-
If omitted we try to find the country in the address components.
414
+
=item* I<country>
399
415
400
-
'only_address', same as only_address global option but set at formatting level
416
+
An uppercase ISO 3166-1 alpha-2 code, e.g. C<'GB'> for Great Britain,
417
+
C<'DE'> for Germany, etc. If omitted the country is determined from
418
+
the address components.
419
+
420
+
=item* I<only_address>
421
+
422
+
Same as the I<only_address> constructor option but applied per-call.
423
+
424
+
=back
401
425
402
426
=cut
403
427
@@ -1172,4 +1196,13 @@ sub _find_unknown_components {
1172
1196
return \@a_unknown;
1173
1197
}
1174
1198
1199
+
=head1SEE ALSO
1200
+
1201
+
L<https://github.com/OpenCageData/address-formatting> - the address
1202
+
formatting template configuration used by this module.
0 commit comments