File Coverage

blib/lib/Locale/ID/Province.pm
Criterion Covered Total %
statement 14 14 100.0
branch n/a
condition n/a
subroutine 5 5 100.0
pod n/a
total 19 19 100.0


line stmt bran cond sub pod time code
1             package Locale::ID::Province;
2              
3 1     1   20751 use 5.010001;
  1         3  
4 1     1   5 use strict;
  1         1  
  1         18  
5 1     1   5 use warnings;
  1         1  
  1         30  
6 1     1   1120 use Perinci::Sub::Gen::AccessTable 0.14 qw(gen_read_table_func);
  1         59363  
  1         64  
7              
8 1     1   8 use Exporter;
  1         2  
  1         555  
9             our @ISA = qw(Exporter);
10             our @EXPORT_OK = qw(
11             list_id_provinces
12             );
13              
14             our %SPEC;
15              
16             our $VERSION = '0.08'; # VERSION
17             our $DATE = '2015-08-17'; # DATE
18              
19             # BEGIN FRAGMENT id=meta
20             # note: This section is generated by a script. Do not edit manually!
21             # src-file: /mnt/home/s1/repos/gudang-data-interim/data/ind_province/meta.yaml
22             # src-revision: ef541a181f42b5ff05eb93f11df3478d75c99bdb
23             # revision-date: Fri Mar 23 11:23:36 2012 +0700
24             # generate-date: Fri Mar 23 14:19:31 2012
25             # generated-by: /mnt/home/s1/repos/gudang-data-interim/bin/gen-perl-meta-snippet
26             our $meta = {
27             "fields" => {
28             bps_code => {
29             "index" => 0,
30             "schema" => ["int*", { max => 99, min => 11 }],
31             "sortable" => 1,
32             "summary" => "BPS code",
33             "summary.alt.lang.id_ID" => "Kode BPS",
34             "unique" => 1,
35             },
36             eng_name => {
37             "index" => 3,
38             "schema" => ["str*", {}],
39             "sortable" => 1,
40             "summary" => "Name (in English)",
41             "summary.alt.lang.id_ID" => "Nama (bahasa Inggris)",
42             "unique" => 1,
43             },
44             ind_capital_name => {
45             "index" => 4,
46             "note" => "TODO link to locality_id",
47             "schema" => ["str*"],
48             "sortable" => 1,
49             "summary" => "Capital name (Indonesian)",
50             "summary.alt.lang.id_ID" => "Nama ibukota (bahasa Indonesia)",
51             },
52             ind_island_name => {
53             "index" => 5,
54             "note" => "TODO link to island_id",
55             "schema" => ["str*", {}],
56             "summary" => "Island (Indonesian)",
57             "summary.alt.lang.id_ID" => "Pulau",
58             },
59             ind_name => {
60             "index" => 2,
61             "schema" => ["str*", {}],
62             "sortable" => 1,
63             "summary" => "Name (in Indonesian)",
64             "summary.alt.lang.id_ID" => "Nama (bahasa Indonesia)",
65             "unique" => 1,
66             },
67             iso3166_2_code => {
68             "index" => 1,
69             "schema" => ["str*", { match => "^[A-Z]{2}-[A-Z]{2}\$" }],
70             "sortable" => 1,
71             "summary" => "ISO 3166-2 code",
72             "summary.alt.lang.id_ID" => "Kode ISO 3166-2",
73             "unique" => 1,
74             },
75             tags => {
76             "index" => 6,
77             "schema" => ["str*"],
78             "summary" => "Tag",
79             "summary.alt.lang.id_ID" => "Tag",
80             },
81             },
82             "pk" => "ind_name",
83             "summary" => "Provinces in Indonesia",
84             "summary.alt.lang.id_ID" => "Provinsi di Indonesia",
85             "table_aliases.alt.lang.id_ID" => ["provinsi_ind"],
86             }
87             ;
88             # END FRAGMENT id=meta
89             # BEGIN FRAGMENT id=data
90             # note: This section is generated by a script. Do not edit manually!
91             # src-file: /mnt/home/s1/repos/gudang-data-interim/data/ind_province/data.csv
92             # src-revision: a2f04185d567a2df0b6020b10189a5c060d22700
93             # revision-date: Wed Dec 14 12:57:27 2011 +0700
94             # generate-date: Fri Mar 23 14:19:31 2012
95             # generated-by: /mnt/home/s1/repos/gudang-data-interim/bin/gen-perl-data-snippet
96             our $data = [
97             ['11','ID-AC','Aceh','Aceh','Banda Aceh','Sumatera','special territory'],
98             ['12','ID-SU','Sumatera Utara','North Sumatra','Medan','Sumatera',''],
99             ['13','ID-SB','Sumatera Barat','West Sumatra','Padang','Sumatera',''],
100             ['14','ID-RI','Riau','Riau','Pekanbaru','Sumatera',''],
101             ['15','ID-JA','Jambi','Jambi','Jambi','Sumatera',''],
102             ['16','ID-SS','Sumatera Selatan','South Sumatra','Palembang','Sumatera',''],
103             ['17','ID-BE','Bengkulu','Bengkulu','Bengkulu','Sumatera',''],
104             ['18','ID-LA','Lampung','Lampung','Bandar Lampung','Sumatera',''],
105             ['19','ID-BB','Kepulauan Bangka Belitung','Bangka Belitung Islands','Pangkal Pinang','Sumatera',''],
106             ['21','ID-KR','Kepulauan Riau','Riau Islands','Tanjung Pinang','Sumatera',''],
107             ['31','ID-JK','Daerah Khusus Ibukota Jakarta','Jakarta Special Capital Territory','Jakarta Pusat','Jawa','special territory,special capital territory,capital'],
108             ['32','ID-JB','Jawa Barat','West Java','Bandung','Jawa',''],
109             ['33','ID-JT','Jawa Tengah','Central Java','Semarang','Jawa',''],
110             ['34','ID-YO','Daerah Istimewa Yogyakarta','Yogyakarta Special Territory','Yogyakarta','Jawa','special territory'],
111             ['35','ID-JI','Jawa Timur','East Java','Surabaya','Jawa',''],
112             ['36','ID-BT','Banten','Banten','Serang','Jawa',''],
113             ['51','ID-BA','Bali','Bali','Denpasar','Bali',''],
114             ['52','ID-NB','Nusa Tenggara Barat','West Nusa Tenggara','Mataram','Nusa Tenggara',''],
115             ['53','ID-NT','Nusa Tenggara Timur','East Nusa Tenggara','Kupang','Nusa Tenggara',''],
116             ['61','ID-KB','Kalimantan Barat','West Kalimantan','Pontianak','Kalimantan',''],
117             ['62','ID-KT','Kalimantan Tengah','Central Kalimantan','Palangkaraya','Kalimantan',''],
118             ['63','ID-KS','Kalimantan Selatan','South Kalimantan','Banjarmasin','Kalimantan',''],
119             ['64','ID-KI','Kalimantan Timur','East Kalimantan','Samarinda','Kalimantan',''],
120             ['71','ID-SA','Sulawesi Utara','North Sulawesi','Manado','Sulawesi',''],
121             ['72','ID-ST','Sulawesi Tengah','Central Sulawesi','Palu','Sulawesi',''],
122             ['73','ID-SN','Sulawesi Selatan','South Sulawesi','Makassar','Sulawesi',''],
123             ['74','ID-SG','Sulawesi Tenggara','South East Sulawesi','Kendari','Sulawesi',''],
124             ['75','ID-GO','Gorontalo','Gorontalo','Gorontalo','Sulawesi',''],
125             ['76','ID-SR','Sulawesi Barat','West Sulawesi','Mamuju','Sulawesi',''],
126             ['81','ID-MA','Maluku','Maluku','Ambon','Maluku',''],
127             ['82','ID-MU','Maluku Utara','North Maluku','Sofifi','Maluku',''],
128             ['91','ID-PB','Papua Barat','West Papua','Manokwari','Papua','special territory'],
129             ['94','ID-PA','Papua','Papua','Jayapura','Papua','special territory'],
130             ]
131             ;
132             # END FRAGMENT id=data
133              
134             my $res = gen_read_table_func(
135             name => 'list_id_provinces',
136             table_data => $data,
137             table_spec => $meta,
138             langs => ['en_US', 'id_ID'],
139             );
140             die "BUG: Can't generate func: $res->[0] - $res->[1]" unless $res->[0] == 200;
141              
142             1;
143             # ABSTRACT: List of provinces in Indonesia
144              
145             __END__
146              
147             =pod
148              
149             =encoding UTF-8
150              
151             =head1 NAME
152              
153             Locale::ID::Province - List of provinces in Indonesia
154              
155             =head1 VERSION
156              
157             This document describes version 0.08 of Locale::ID::Province (from Perl distribution Locale-ID-Province), released on 2015-08-17.
158              
159             =head1 SYNOPSIS
160              
161             use Locale::ID::Province qw(list_id_provinces);
162             my $res = list_id_provinces();
163              
164             =head1 DESCRIPTION
165              
166             This module provides API access for list of provinces in Indonesia. Data is
167             currently retrieved from the B<gudang-data-interim> repository at
168             https://github.com/sharyanto/gudang-data-interim/tree/master/data/ind_province/
169              
170             This module's functions has L<Rinci> specs.
171              
172             =head1 FUNCTIONS
173              
174              
175             =head2 list_id_provinces(%args) -> [status, msg, result, meta]
176              
177             {en_US Provinces in Indonesia}.
178              
179             {en_US REPLACE ME}
180              
181             Arguments ('*' denotes required arguments):
182              
183             =over 4
184              
185             =item * B<bps_code> => I<int>
186              
187             {en_US Only return records where the 'bps_code' field equals specified value}.
188              
189             =item * B<bps_code.in> => I<array[int]>
190              
191             {en_US Only return records where the 'bps_code' field is in the specified values}.
192              
193             =item * B<bps_code.is> => I<int>
194              
195             {en_US Only return records where the 'bps_code' field equals specified value}.
196              
197             =item * B<bps_code.isnt> => I<int>
198              
199             {en_US Only return records where the 'bps_code' field does not equal specified value}.
200              
201             =item * B<bps_code.max> => I<int>
202              
203             {en_US Only return records where the 'bps_code' field is less than or equal to specified value}.
204              
205             =item * B<bps_code.min> => I<int>
206              
207             {en_US Only return records where the 'bps_code' field is greater than or equal to specified value}.
208              
209             =item * B<bps_code.not_in> => I<array[int]>
210              
211             {en_US Only return records where the 'bps_code' field is not in the specified values}.
212              
213             =item * B<bps_code.xmax> => I<int>
214              
215             {en_US Only return records where the 'bps_code' field is less than specified value}.
216              
217             =item * B<bps_code.xmin> => I<int>
218              
219             {en_US Only return records where the 'bps_code' field is greater than specified value}.
220              
221             =item * B<detail> => I<bool> (default: 0)
222              
223             {en_US Return array of full records instead of just ID fields}.
224              
225             {en_US
226             By default, only the key (ID) field is returned per result entry.
227             }
228              
229             =item * B<eng_name> => I<str>
230              
231             {en_US Only return records where the 'eng_name' field equals specified value}.
232              
233             =item * B<eng_name.contains> => I<str>
234              
235             {en_US Only return records where the 'eng_name' field contains specified text}.
236              
237             =item * B<eng_name.in> => I<array[str]>
238              
239             {en_US Only return records where the 'eng_name' field is in the specified values}.
240              
241             =item * B<eng_name.is> => I<str>
242              
243             {en_US Only return records where the 'eng_name' field equals specified value}.
244              
245             =item * B<eng_name.isnt> => I<str>
246              
247             {en_US Only return records where the 'eng_name' field does not equal specified value}.
248              
249             =item * B<eng_name.max> => I<str>
250              
251             {en_US Only return records where the 'eng_name' field is less than or equal to specified value}.
252              
253             =item * B<eng_name.min> => I<str>
254              
255             {en_US Only return records where the 'eng_name' field is greater than or equal to specified value}.
256              
257             =item * B<eng_name.not_contains> => I<str>
258              
259             {en_US Only return records where the 'eng_name' field does not contain specified text}.
260              
261             =item * B<eng_name.not_in> => I<array[str]>
262              
263             {en_US Only return records where the 'eng_name' field is not in the specified values}.
264              
265             =item * B<eng_name.xmax> => I<str>
266              
267             {en_US Only return records where the 'eng_name' field is less than specified value}.
268              
269             =item * B<eng_name.xmin> => I<str>
270              
271             {en_US Only return records where the 'eng_name' field is greater than specified value}.
272              
273             =item * B<fields> => I<array[str]>
274              
275             {en_US Select fields to return}.
276              
277             =item * B<ind_capital_name> => I<str>
278              
279             {en_US Only return records where the 'ind_capital_name' field equals specified value}.
280              
281             =item * B<ind_capital_name.contains> => I<str>
282              
283             {en_US Only return records where the 'ind_capital_name' field contains specified text}.
284              
285             =item * B<ind_capital_name.in> => I<array[str]>
286              
287             {en_US Only return records where the 'ind_capital_name' field is in the specified values}.
288              
289             =item * B<ind_capital_name.is> => I<str>
290              
291             {en_US Only return records where the 'ind_capital_name' field equals specified value}.
292              
293             =item * B<ind_capital_name.isnt> => I<str>
294              
295             {en_US Only return records where the 'ind_capital_name' field does not equal specified value}.
296              
297             =item * B<ind_capital_name.max> => I<str>
298              
299             {en_US Only return records where the 'ind_capital_name' field is less than or equal to specified value}.
300              
301             =item * B<ind_capital_name.min> => I<str>
302              
303             {en_US Only return records where the 'ind_capital_name' field is greater than or equal to specified value}.
304              
305             =item * B<ind_capital_name.not_contains> => I<str>
306              
307             {en_US Only return records where the 'ind_capital_name' field does not contain specified text}.
308              
309             =item * B<ind_capital_name.not_in> => I<array[str]>
310              
311             {en_US Only return records where the 'ind_capital_name' field is not in the specified values}.
312              
313             =item * B<ind_capital_name.xmax> => I<str>
314              
315             {en_US Only return records where the 'ind_capital_name' field is less than specified value}.
316              
317             =item * B<ind_capital_name.xmin> => I<str>
318              
319             {en_US Only return records where the 'ind_capital_name' field is greater than specified value}.
320              
321             =item * B<ind_island_name> => I<str>
322              
323             {en_US Only return records where the 'ind_island_name' field equals specified value}.
324              
325             =item * B<ind_island_name.contains> => I<str>
326              
327             {en_US Only return records where the 'ind_island_name' field contains specified text}.
328              
329             =item * B<ind_island_name.in> => I<array[str]>
330              
331             {en_US Only return records where the 'ind_island_name' field is in the specified values}.
332              
333             =item * B<ind_island_name.is> => I<str>
334              
335             {en_US Only return records where the 'ind_island_name' field equals specified value}.
336              
337             =item * B<ind_island_name.isnt> => I<str>
338              
339             {en_US Only return records where the 'ind_island_name' field does not equal specified value}.
340              
341             =item * B<ind_island_name.max> => I<str>
342              
343             {en_US Only return records where the 'ind_island_name' field is less than or equal to specified value}.
344              
345             =item * B<ind_island_name.min> => I<str>
346              
347             {en_US Only return records where the 'ind_island_name' field is greater than or equal to specified value}.
348              
349             =item * B<ind_island_name.not_contains> => I<str>
350              
351             {en_US Only return records where the 'ind_island_name' field does not contain specified text}.
352              
353             =item * B<ind_island_name.not_in> => I<array[str]>
354              
355             {en_US Only return records where the 'ind_island_name' field is not in the specified values}.
356              
357             =item * B<ind_island_name.xmax> => I<str>
358              
359             {en_US Only return records where the 'ind_island_name' field is less than specified value}.
360              
361             =item * B<ind_island_name.xmin> => I<str>
362              
363             {en_US Only return records where the 'ind_island_name' field is greater than specified value}.
364              
365             =item * B<ind_name> => I<str>
366              
367             {en_US Only return records where the 'ind_name' field equals specified value}.
368              
369             =item * B<ind_name.contains> => I<str>
370              
371             {en_US Only return records where the 'ind_name' field contains specified text}.
372              
373             =item * B<ind_name.in> => I<array[str]>
374              
375             {en_US Only return records where the 'ind_name' field is in the specified values}.
376              
377             =item * B<ind_name.is> => I<str>
378              
379             {en_US Only return records where the 'ind_name' field equals specified value}.
380              
381             =item * B<ind_name.isnt> => I<str>
382              
383             {en_US Only return records where the 'ind_name' field does not equal specified value}.
384              
385             =item * B<ind_name.max> => I<str>
386              
387             {en_US Only return records where the 'ind_name' field is less than or equal to specified value}.
388              
389             =item * B<ind_name.min> => I<str>
390              
391             {en_US Only return records where the 'ind_name' field is greater than or equal to specified value}.
392              
393             =item * B<ind_name.not_contains> => I<str>
394              
395             {en_US Only return records where the 'ind_name' field does not contain specified text}.
396              
397             =item * B<ind_name.not_in> => I<array[str]>
398              
399             {en_US Only return records where the 'ind_name' field is not in the specified values}.
400              
401             =item * B<ind_name.xmax> => I<str>
402              
403             {en_US Only return records where the 'ind_name' field is less than specified value}.
404              
405             =item * B<ind_name.xmin> => I<str>
406              
407             {en_US Only return records where the 'ind_name' field is greater than specified value}.
408              
409             =item * B<iso3166_2_code> => I<str>
410              
411             {en_US Only return records where the 'iso3166_2_code' field equals specified value}.
412              
413             =item * B<iso3166_2_code.contains> => I<str>
414              
415             {en_US Only return records where the 'iso3166_2_code' field contains specified text}.
416              
417             =item * B<iso3166_2_code.in> => I<array[str]>
418              
419             {en_US Only return records where the 'iso3166_2_code' field is in the specified values}.
420              
421             =item * B<iso3166_2_code.is> => I<str>
422              
423             {en_US Only return records where the 'iso3166_2_code' field equals specified value}.
424              
425             =item * B<iso3166_2_code.isnt> => I<str>
426              
427             {en_US Only return records where the 'iso3166_2_code' field does not equal specified value}.
428              
429             =item * B<iso3166_2_code.max> => I<str>
430              
431             {en_US Only return records where the 'iso3166_2_code' field is less than or equal to specified value}.
432              
433             =item * B<iso3166_2_code.min> => I<str>
434              
435             {en_US Only return records where the 'iso3166_2_code' field is greater than or equal to specified value}.
436              
437             =item * B<iso3166_2_code.not_contains> => I<str>
438              
439             {en_US Only return records where the 'iso3166_2_code' field does not contain specified text}.
440              
441             =item * B<iso3166_2_code.not_in> => I<array[str]>
442              
443             {en_US Only return records where the 'iso3166_2_code' field is not in the specified values}.
444              
445             =item * B<iso3166_2_code.xmax> => I<str>
446              
447             {en_US Only return records where the 'iso3166_2_code' field is less than specified value}.
448              
449             =item * B<iso3166_2_code.xmin> => I<str>
450              
451             {en_US Only return records where the 'iso3166_2_code' field is greater than specified value}.
452              
453             =item * B<query> => I<str>
454              
455             {en_US Search}.
456              
457             =item * B<random> => I<bool> (default: 0)
458              
459             {en_US Return records in random order}.
460              
461             =item * B<result_limit> => I<int>
462              
463             {en_US Only return a certain number of records}.
464              
465             =item * B<result_start> => I<int> (default: 1)
466              
467             {en_US Only return starting from the n'th record}.
468              
469             =item * B<sort> => I<str>
470              
471             {en_US Order records according to certain field(s)}.
472              
473             {en_US
474             A list of field names separated by comma. Each field can be prefixed with '-' to
475             specify descending order instead of the default ascending.
476             }
477              
478             =item * B<tags> => I<str>
479              
480             {en_US Only return records where the 'tags' field equals specified value}.
481              
482             =item * B<tags.contains> => I<str>
483              
484             {en_US Only return records where the 'tags' field contains specified text}.
485              
486             =item * B<tags.in> => I<array[str]>
487              
488             {en_US Only return records where the 'tags' field is in the specified values}.
489              
490             =item * B<tags.is> => I<str>
491              
492             {en_US Only return records where the 'tags' field equals specified value}.
493              
494             =item * B<tags.isnt> => I<str>
495              
496             {en_US Only return records where the 'tags' field does not equal specified value}.
497              
498             =item * B<tags.max> => I<str>
499              
500             {en_US Only return records where the 'tags' field is less than or equal to specified value}.
501              
502             =item * B<tags.min> => I<str>
503              
504             {en_US Only return records where the 'tags' field is greater than or equal to specified value}.
505              
506             =item * B<tags.not_contains> => I<str>
507              
508             {en_US Only return records where the 'tags' field does not contain specified text}.
509              
510             =item * B<tags.not_in> => I<array[str]>
511              
512             {en_US Only return records where the 'tags' field is not in the specified values}.
513              
514             =item * B<tags.xmax> => I<str>
515              
516             {en_US Only return records where the 'tags' field is less than specified value}.
517              
518             =item * B<tags.xmin> => I<str>
519              
520             {en_US Only return records where the 'tags' field is greater than specified value}.
521              
522             =item * B<with_field_names> => I<bool>
523              
524             {en_US Return field names in each record (as hash/associative array)}.
525              
526             {en_US
527             When enabled, function will return each record as hash/associative array
528             (field name => value pairs). Otherwise, function will return each record
529             as list/array (field value, field value, ...).
530             }
531              
532             =back
533              
534             Returns an enveloped result (an array).
535              
536             First element (status) is an integer containing HTTP status code
537             (200 means OK, 4xx caller error, 5xx function error). Second element
538             (msg) is a string containing error message, or 'OK' if status is
539             200. Third element (result) is optional, the actual result. Fourth
540             element (meta) is called result metadata and is optional, a hash
541             that contains extra information.
542              
543             Return value: (any)
544              
545             =head1 SEE ALSO
546              
547             L<list-id-provinces>
548              
549             Gudang Data Interim project, https://github.com/sharyanto/gudang-data-interim/
550              
551             This API will also be available on GudangAPI, http://gudangapi.com/
552              
553             =head1 HOMEPAGE
554              
555             Please visit the project's homepage at L<https://metacpan.org/release/Locale-ID-Province>.
556              
557             =head1 SOURCE
558              
559             Source repository is at L<https://github.com/sharyanto/perl-Locale-ID-Province>.
560              
561             =head1 BUGS
562              
563             Please report any bugs or feature requests on the bugtracker website L<https://rt.cpan.org/Public/Dist/Display.html?Name=Locale-ID-Province>
564              
565             When submitting a bug or request, please include a test-file or a
566             patch to an existing test-file that illustrates the bug or desired
567             feature.
568              
569             =head1 AUTHOR
570              
571             perlancar <perlancar@cpan.org>
572              
573             =head1 COPYRIGHT AND LICENSE
574              
575             This software is copyright (c) 2015 by perlancar@cpan.org.
576              
577             This is free software; you can redistribute it and/or modify it under
578             the same terms as the Perl 5 programming language system itself.
579              
580             =cut