blib/lib/Locale/Country/Geo.pm

filter: Statementstmt 78.2% 18 / 23 Branchbran 0.0% 0 / 2 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 80.0% 4 / 5 Podpod 100% 1 / 1 totaltotal 74.1% 23 / 31 CC 2 SCAR 9.8
CC
2
Cov
72%
geolocation
6.0
BEGIN
1.0
BEGIN
1.0
CRAP 2.7
↑ Summary
1 package Locale::Country::Geo;
2  
3 2 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 2 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
5  
6 =head1 NAME
7  
8 Locale::Country::Geo - Module for country geographic location data
9  
10 =head1 VERSION
11  
12 Version 0.01
13  
14 =cut
15  
16 2 our $VERSION = '0.01';
17  
18 =head1 SYNOPSIS
19  
20 use Locale::Country::Geo;
21 my ($lat, $lon) = Locale::Country::Geo->geolocation('tw');
22  
23 =head1 DESCRIPTION
24  
25 The information are from google's geocoding service. You can obtain
26 the data by running F<scripts/reload.pl>.
27  
28 =cut
29  
30 2 ▶use Carp ();
Subroutine BEGIN: called CC=1 SCAR=0.0
31 2 ▶use YAML::Syck ();
Subroutine BEGIN: called CC=1 SCAR=0.0
32 2 my $DATA;
33 {
34 2 local $/;
35 2 $DATA = YAML::Syck::Load(<DATA>);
36 }
37  
38 =head1 METHODS
39  
40 =head2 geolocation
41  
42 =cut
43  
44 0 ▶sub geolocation {
Subroutine geolocation: not called CC=2 SCAR=17.9
Pod documented
45 0 my $class = shift;
46 0 my $code = shift;
47  
48 Carp::croak "Unknown country code: $code"
49 0 ▶ unless exists $DATA->{$code};
Branch: 1 branch
BranchTrueFalseTotal
unless exists $DATA->{$code} 0 0 0
50  
51 0 return @{$DATA->{$code}};
52 }
53  
54 =head1 AUTHOR
55  
56 clkao, C<< <clkao at clkao.org> >>
57  
58 =head1 BUGS
59  
60 Please report any bugs or feature requests to
61 C<bug-locale-country-geo at rt.cpan.org>, or through the web interface at
62 L<http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Locale-Country-Geo>.
63 I will be notified, and then you'll automatically be notified of progress on
64 your bug as I make changes.
65  
66 =head1 SUPPORT
67  
68 You can find documentation for this module with the perldoc command.
69  
70 perldoc Locale::Country::Geo
71  
72 You can also look for information at:
73  
74 =over 4
75  
76 =item * AnnoCPAN: Annotated CPAN documentation
77  
78 L<http://annocpan.org/dist/Locale-Country-Geo>
79  
80 =item * CPAN Ratings
81  
82 L<http://cpanratings.perl.org/d/Locale-Country-Geo>
83  
84 =item * RT: CPAN's request tracker
85  
86 L<http://rt.cpan.org/NoAuth/Bugs.html?Dist=Locale-Country-Geo>
87  
88 =item * Search CPAN
89  
90 L<http://search.cpan.org/dist/Locale-Country-Geo>
91  
92 =back
93  
94 =head1 ACKNOWLEDGEMENTS
95  
96 =head1 COPYRIGHT & LICENSE
97  
98 Copyright 2007 clkao, all rights reserved.
99  
100 This program is free software; you can redistribute it and/or modify it
101 under the same terms as Perl itself.
102  
103 =cut
104  
105 2 1; # End of Locale::Country::Geo
106 __DATA__
↑ Summary