File Coverage

blib/lib/Data/OFN/Address.pm
Criterion Covered Total %
statement 57 57 100.0
branch 2 2 100.0
condition 3 3 100.0
subroutine 10 10 100.0
pod 0 1 0.0
total 72 73 98.6


line stmt bran cond sub pod time code
1             package Data::OFN::Address;
2              
3 116     116   2821824 use strict;
  116         315  
  116         13060  
4 116     116   638 use warnings;
  116         418  
  116         17764  
5              
6 116     116   55353 use Error::Pure qw(err);
  116         1693538  
  116         3459  
7 116     116   80932 use Mo qw(build default is);
  116         80549  
  116         758  
8 116     116   398740 use Mo::utils 0.31 qw(check_length_fix check_regexp check_strings);
  116         372377  
  116         8028  
9 116     116   86201 use Mo::utils::Array qw(check_array_object);
  116         331879  
  116         3149  
10 116     116   71345 use Mo::utils::Number qw(check_positive_natural);
  116         299331  
  116         3445  
11 116     116   10712 use Readonly;
  116         315  
  116         5908  
12 116     116   56269 use Unicode::UTF8 qw(decode_utf8);
  116         83362  
  116         141111  
13              
14             Readonly::Array our @HOUSE_NUMBER_TYPES => (
15             decode_utf8('č.p.'),
16             decode_utf8('č.ev.'),
17             );
18              
19             our $VERSION = 0.02;
20              
21             has address_place => (
22             is => 'ro',
23             );
24              
25             has address_place_code => (
26             is => 'ro',
27             );
28              
29             has cadastral_area => (
30             is => 'ro',
31             );
32              
33             has cadastral_area_name => (
34             default => [],
35             is => 'ro',
36             );
37              
38             has conscription_number => (
39             is => 'ro',
40             );
41              
42             has conscription_number_flag => (
43             is => 'ro',
44             );
45              
46             has district => (
47             is => 'ro',
48             );
49              
50             has district_name => (
51             default => [],
52             is => 'ro',
53             );
54              
55             has element_ruian => (
56             is => 'ro',
57             );
58              
59             has house_number => (
60             is => 'ro',
61             );
62              
63             has house_number_type => (
64             is => 'ro',
65             );
66              
67             has id => (
68             is => 'ro',
69             );
70              
71             has momc => (
72             is => 'ro',
73             );
74              
75             has momc_name => (
76             default => [],
77             is => 'ro',
78             );
79              
80             has mop => (
81             is => 'ro',
82             );
83              
84             has mop_name => (
85             default => [],
86             is => 'ro',
87             );
88              
89             has municipality => (
90             is => 'ro',
91             );
92              
93             has municipality_name => (
94             default => [],
95             is => 'ro',
96             );
97              
98             has municipality_part => (
99             is => 'ro',
100             );
101              
102             has municipality_part_name => (
103             default => [],
104             is => 'ro',
105             );
106              
107             has psc => (
108             is => 'ro',
109             );
110              
111             has street => (
112             is => 'ro',
113             );
114              
115             has street_name => (
116             default => [],
117             is => 'ro',
118             );
119              
120             has text => (
121             default => [],
122             is => 'ro',
123             );
124              
125             has vusc => (
126             is => 'ro',
127             );
128              
129             has vusc_name => (
130             default => [],
131             is => 'ro',
132             );
133              
134             sub BUILD {
135 173     173 0 10774958 my $self = shift;
136              
137             # Check address_place.
138 173         1480 check_regexp($self, 'address_place',
139             qr{^https://linked\.cuzk\.cz/resource/ruian/adresni-misto/\d+$});
140              
141             # Check address_place_code.
142 171         5382 check_positive_natural($self, 'address_place_code');
143              
144             # Check cadastral_area.
145 170         2603 check_regexp($self, 'cadastral_area',
146             qr{^https://linked\.cuzk\.cz/resource/ruian/katastralni-uzemi/\d+$});
147              
148             # Check cadastral_area_name.
149 168         2709 check_array_object($self, 'cadastral_area_name', 'Data::Text::Simple');
150              
151             # Check conscription_number.
152 166         1904 check_positive_natural($self, 'conscription_number');
153              
154             # Check conscription_number_flag.
155 165 100 100     3510 if (! defined $self->{'conscription_number'}
156             && defined $self->{'conscription_number_flag'}) {
157              
158 1         13 err "Parameter 'conscription_number_flag' is possible with 'conscription_number' parameter only.";
159             }
160              
161             # Check district.
162 164         1045 check_regexp($self, 'district',
163             qr{^https://linked\.cuzk\.cz/resource/ruian/okres/\d+});
164              
165             # Check district_name.
166 164         2077 check_array_object($self, 'district_name', 'Data::Text::Simple');
167              
168             # Check element_ruian.
169 164         1595 check_regexp($self, 'element_ruian',
170             qr{^https://linked\.cuzk\.cz/resource/ruian/parcela/\d+$});
171              
172             # Check house_number.
173 163         1990 check_positive_natural($self, 'house_number');
174              
175             # Check house_number_type.
176 162         2500 check_strings($self, 'house_number_type', \@HOUSE_NUMBER_TYPES);
177              
178             # Check id.
179 161         3494 check_positive_natural($self, 'id');
180              
181             # Check momc.
182 161         1989 check_regexp($self, 'momc',
183             qr{^https://linked\.cuzk\.cz/resource/ruian/momc/\d+$});
184              
185             # Check momc_name.
186 160         1906 check_array_object($self, 'momc_name', 'Data::Text::Simple');
187              
188             # Check mop.
189 158         1465 check_regexp($self, 'mop',
190             qr{^https://linked\.cuzk\.cz/resource/ruian/mop/\d+$});
191              
192             # Check mop_name.
193 157         1779 check_array_object($self, 'mop_name', 'Data::Text::Simple');
194              
195             # Check municipality.
196 155         1312 check_regexp($self, 'municipality',
197             qr{^https://linked\.cuzk\.cz/resource/ruian/obec/\d+$});
198              
199             # Check municipality_name.
200 154         1830 check_array_object($self, 'municipality_name', 'Data::Text::Simple');
201              
202             # Check municipality_part.
203 152         2453 check_regexp($self, 'municipality_part',
204             qr{^https://linked\.cuzk\.cz/resource/ruian/cast-obce/\d+$});
205              
206             # Check municipality_part_name.
207 151         1837 check_array_object($self, 'municipality_part_name', 'Data::Text::Simple');
208              
209             # Check psc.
210 149         1425 check_length_fix($self, 'psc', 5);
211 147         1763 check_regexp($self, 'psc', qw{^\d+$});
212              
213             # Check street.
214 146         3412 check_regexp($self, 'street',
215             qr{^https://linked\.cuzk\.cz/resource/ruian/ulice/\d+$});
216              
217             # Check street_name.
218 145         1705 check_array_object($self, 'street_name', 'Data::Text::Simple');
219              
220             # Check text.
221 143         1762 check_array_object($self, 'text', 'Data::Text::Simple');
222              
223             # Check vusc.
224 141         2647 check_regexp($self, 'vusc',
225             qr{^https://linked\.cuzk\.cz/resource/ruian/vusc/\d+$});
226              
227             # Check vusc_name.
228 140         1674 check_array_object($self, 'vusc_name', 'Data::Text::Simple');
229              
230 138         1087 return;
231             }
232              
233             1;
234              
235             __END__
236              
237             =pod
238              
239             =encoding utf8
240              
241             =head1 NAME
242              
243             Data::OFN::Address - Data object for OFN address.
244              
245             =head1 SYNOPSIS
246              
247             use Data::OFN::Address;
248              
249             my $obj = Data::OFN::Address->new(%params);
250             my $address_place = $obj->address_place;
251             my $address_place_code = $obj->address_place_code;
252             my $cadastral_area = $obj->cadastral_area;
253             my $cadastral_area_name_ar = $obj->cadastral_area_name;
254             my $conscription_number = $obj->conscription_number;
255             my $conscription_number_flag = $obj->conscription_number_flag;
256             my $district = $obj->district;
257             my $district_name_ar = $obj->district_name;
258             my $element_ruian = $obj->element_ruian;
259             my $house_number = $obj->house_number;
260             my $house_number_type = $obj->house_number_type;
261             my $id = $obj->id;
262             my $momc = $obj->momc;
263             my $momc_name_ar = $obj->momc_name;
264             my $mop = $obj->mop;
265             my $mop_name_ar = $obj->mop_name;
266             my $municipality = $obj->municipality;
267             my $municipality_name_ar = $obj->municipality_name;
268             my $municipality_part = $obj->municipality_part;
269             my $municipality_part_name_ar = $obj->municipality_part_name;
270             my $psc = $obj->psc;
271             my $street = $obj->street;
272             my $street_name_ar = $obj->street_name;
273             my $text_ar = $obj->text;
274             my $vusc = $obj->vusc;
275             my $vusc_name_ar = $obj->vusc_name;
276              
277             =head1 DESCRIPTION
278              
279             Immutable data object for OFN (Otevřené formální normy) representation of
280             address in the Czech Republic.
281              
282             This object is actual with L<2020-07-01|https://ofn.gov.cz/adresy/2020-07-01/> version of
283             OFN address standard.
284              
285             =head1 METHODS
286              
287             =head2 C<new>
288              
289             my $obj = Data::OFN::Address->new(%params);
290              
291             Constructor.
292              
293             =over 8
294              
295             =item * C<address_place>
296              
297             Address place IRI.
298              
299             IRI has format https://linked.cuzk.cz/resource/ruian/adresni-misto/ and unique
300             number on the end.
301              
302             It's optional.
303              
304             =item * C<address_place_code>
305              
306             Address place numeric code.
307              
308             Same number as on the C<address_place> end.
309              
310             It's optional.
311              
312             =item * C<cadastral_area>
313              
314             Address cadastral area IRI.
315              
316             IRI has format https://linked.cuzk.cz/resource/ruian/katastralni-uzemi/ and
317             unique number on the end.
318              
319             It's optional.
320              
321             Default value is undef.
322              
323             =item * C<cadastral_area_name>
324              
325             Address cadastral area name(s).
326              
327             This name is in form of reference to array of L<Data::Text::Simple> instances
328             with language definition.
329              
330             It's optional.
331              
332             Default value is [].
333              
334             =item * C<conscription_number>
335              
336             Address consciption number.
337              
338             It's optional.
339              
340             Default value is undef.
341              
342             =item * C<conscription_number_flag>
343              
344             Address conscription number type.
345              
346             It's possible to set in case if C<conscription_number> is set. It's something
347             like C<a> if this is defined in real number.
348              
349             It's optional.
350              
351             Default value is undef.
352              
353             =item * C<district>
354              
355             Address district IRI.
356              
357             IRI has format https://linked.cuzk.cz/resource/ruian/okres/ and
358             unique number on the end.
359              
360             It's optional.
361              
362             Default value is undef.
363              
364             =item * C<district_name>
365              
366             Address district name(s).
367              
368             This name is in form of reference to array of L<Data::Text::Simple> instances
369             with language definition.
370              
371             It's optional.
372              
373             Default value is [].
374              
375             =item * C<element_ruian>
376              
377             Address element IRI from the RÚIAN register.
378              
379             IRI has format https://linked.cuzk.cz/resource/ruian/parcela/ and
380             unique number on the end.
381              
382             It's optional.
383              
384             Default value is undef.
385              
386             =item * C<house_number>
387              
388             Address house number.
389              
390             It's optional.
391              
392             Default value is undef.
393              
394             =item * C<house_number_type>
395              
396             Address house number type.
397              
398             Possible term values are:
399              
400             =over
401              
402             =item * č.p.
403              
404             The building object descriptive number.
405              
406             =item * č.ev.
407              
408             The building registration number.
409              
410             =back
411              
412             It's optional.
413              
414             Default value is undef.
415              
416             =item * C<id>
417              
418             Address id.
419              
420             This is not official identifier of address in the Czech Republic.
421             It's used for internal identification like database.
422              
423             It's optional.
424              
425             Default value is undef.
426              
427             =item * C<momc>
428              
429             Address city district IRI.
430              
431             IRI has format https://linked.cuzk.cz/resource/ruian/momc/ and
432             unique number on the end.
433              
434             It's optional.
435              
436             Default value is undef.
437              
438             =item * C<momc_name>
439              
440             Address city district name(s).
441              
442             This name is in form of reference to array of L<Data::Text::Simple> instances
443             with language definition.
444              
445             It's optional.
446              
447             Default value is [].
448              
449             =item * C<mop>
450              
451             Municipal district in the capital city of Prague IRI.
452              
453             IRI has format https://linked.cuzk.cz/resource/ruian/mop/ and unique number
454             on the end.
455              
456             It's optional.
457              
458             Default value is undef.
459              
460             =item * C<mop_name>
461              
462             Municipal district in the capital city of Prague name(s).
463              
464             This name is in form of reference to array of L<Data::Text::Simple> instances
465             with language definition.
466              
467             It's optional.
468              
469             Default value is [].
470              
471             =item * C<municipality>
472              
473             Municipality or military district IRI.
474              
475             IRI has format https://linked.cuzk.cz/resource/ruian/obec/ and unique number on
476             the end.
477              
478             It's optional.
479              
480             Default value is undef.
481              
482             =item * C<municipality_name>
483              
484             Municipality or military district name(s).
485              
486             This name is in form of reference to array of L<Data::Text::Simple> instances
487             with language definition.
488              
489             It's optional.
490              
491             Default value is [].
492              
493             =item * C<municipality_part>
494              
495             Part of the village IRI.
496              
497             IRI has format https://linked.cuzk.cz/resource/ruian/cast-obce/ and unique
498             number on the end.
499              
500             It's optional.
501              
502             Default value is undef.
503              
504             =item * C<municipality_part_name>
505              
506             Part of the village name(s).
507              
508             This name is in form of reference to array of L<Data::Text::Simple> instances
509             with language definition.
510              
511             It's optional.
512              
513             Default value is [].
514              
515             =item * C<psc>
516              
517             Zip code.
518              
519             The form is 5 character length number.
520              
521             It's optional.
522              
523             Default value is undef.
524              
525             =item * C<street>
526              
527             Street IRI.
528              
529             IRI has format https://linked.cuzk.cz/resource/ruian/ulice/ and unique number on
530             the end.
531              
532             It's optional.
533              
534             Default value is undef.
535              
536             =item * C<street_name>
537              
538             Street name.
539              
540             This name is in form of reference to array of L<Data::Text::Simple> instances
541             with language definition.
542              
543             It's optional.
544              
545             Default value is [].
546              
547             =item * C<text>
548              
549             Address text.
550              
551             This name is in form of reference to array of L<Data::Text::Simple> instances
552             with language definition.
553              
554             It's optional.
555              
556             Default value is [].
557              
558             =item * C<vusc>
559              
560             Higher territorial self-governing unit IRI.
561              
562             IRI has format https://linked.cuzk.cz/resource/ruian/vusc/ and unique number on
563             the end.
564              
565             It's optional.
566              
567             Default value is undef.
568              
569             =item * C<vusc_name>
570              
571             Higher territorial self-governing unit name(s).
572              
573             This name is in form of reference to array of L<Data::Text::Simple> instances
574             with language definition.
575              
576             It's optional.
577              
578             Default value is [].
579              
580             =back
581              
582             Returns instance of object.
583              
584             =head2 C<address_place>
585              
586             my $address_place = $obj->address_place;
587              
588             Get address place IRI.
589              
590             Returns string with IRI.
591              
592             =head2 C<address_place_code>
593              
594             my $address_place_code = $obj->address_place_code;
595              
596             Get address place numeric code.
597              
598             Returns number.
599              
600             =head2 C<cadastral_area>
601              
602             my $cadastral_area = $obj->cadastral_area;
603              
604             Get address cadastral area IRI.
605              
606             Returns string with IRI.
607              
608             =head2 C<cadastral_area_name>
609              
610             my $cadastral_area_name_ar = $obj->cadastral_area_name;
611              
612             Get address cadastral area name(s).
613              
614             Returns reference to array with L<Data::Text::Simple> instances.
615              
616             =head2 C<conscription_number>
617              
618             my $conscription_number = $obj->conscription_number;
619              
620             Get address consciption number.
621              
622             Returns number.
623              
624             =head2 C<conscription_number_flag>
625              
626             my $conscription_number_flag = $obj->conscription_number_flag;
627              
628             Get address conscription number type.
629              
630             Returns string.
631              
632             =head2 C<district>
633              
634             my $district = $obj->district;
635              
636             Get address district IRI.
637              
638             Returns string with IRI.
639              
640             =head2 C<district_name>
641              
642             my $district_name_ar = $obj->district_name;
643              
644             Get address district name(s).
645              
646             Returns reference to array with L<Data::Text::Simple> instances.
647              
648             =head2 C<element_ruian>
649              
650             my $element_ruian = $obj->element_ruian;
651              
652             Get address element IRI from the RÚIAN register.
653              
654             Returns string with IRI.
655              
656             =head2 C<house_number>
657              
658             my $house_number = $obj->house_number;
659              
660             Get address house number.
661              
662             Returns string.
663              
664             =head2 C<house_number_type>
665              
666             my $house_number_type = $obj->house_number_type;
667              
668             Get address house number type.
669              
670             Returns string.
671              
672             =head2 C<id>
673              
674             my $id = $obj->id;
675              
676             Get OFN address id.
677              
678             Returns number.
679              
680             =head2 C<momc>
681              
682             my $momc = $obj->momc;
683              
684             Get address city district IRI.
685              
686             Returns string with IRI.
687              
688             =head2 C<momc_name>
689              
690             my $momc_name_ar = $obj->momc_name;
691              
692             Get address city district name(s).
693              
694             Returns reference to array with L<Data::Text::Simple> instances.
695              
696             =head2 C<mop>
697              
698             my $mop = $obj->mop;
699              
700             Get municipal district in the capital city of Prague IRI.
701              
702             Returns string with IRI.
703              
704             =head2 C<mop_name>
705              
706             my $mop_name_ar = $obj->mop_name;
707              
708             Get municipal district in the capital city of Prague name(s).
709              
710             Returns reference to array with L<Data::Text::Simple> instances.
711              
712             =head2 C<municipality>
713              
714             my $municipality = $obj->municipality;
715              
716             Get municipality or military district IRI.
717              
718             Returns string with IRI.
719              
720             =head2 C<municipality_name>
721              
722             my $municipality_name_ar = $obj->municipality_name;
723              
724             Get municipality or military district name(s).
725              
726             Returns reference to array with L<Data::Text::Simple> instances.
727              
728             =head2 C<municipality_part>
729              
730             my $municipality_part = $obj->municipality_part;
731              
732             Get part of the village IRI.
733              
734             Returns string with IRI.
735              
736             =head2 C<municipality_part_name>
737              
738             my $municipality_part_name_ar = $obj->municipality_part_name;
739              
740             Get part of the village name(s).
741              
742             Returns reference to array with L<Data::Text::Simple> instances.
743              
744             =head2 C<psc>
745              
746             my $psc = $obj->psc;
747              
748             Get zip code.
749              
750             Returns number.
751              
752             =head2 C<street>
753              
754             my $street = $obj->street;
755              
756             Get street IRI.
757              
758             Returns string with IRI.
759              
760             =head2 C<street_name>
761              
762             my $street_name_ar = $obj->street_name;
763              
764             Get street name.
765              
766             Returns reference to array with L<Data::Text::Simple> instances.
767              
768             =head2 C<text>
769              
770             my $text_ar = $obj->text;
771              
772             Get address text.
773              
774             Returns reference to array with L<Data::Text::Simple> instances.
775              
776             =head2 C<vusc>
777              
778             my $vusc = $obj->vusc;
779              
780             Get higher territorial self-governing unit IRI.
781              
782             Returns string with IRI.
783              
784             =head2 C<vusc_name>
785              
786             my $vusc_name_ar = $obj->vusc_name;
787              
788             Get higher territorial self-governing unit name(s).
789              
790             Returns reference to array with L<Data::Text::Simple> instances.
791              
792             =head1 ERRORS
793              
794             new():
795             From Mo::utils::check_array_object():
796             Parameter 'cadastral_area_name' must be a array.
797             Value: %s
798             Reference: %s
799             Parameter 'cadastral_area_name' with array must contain 'Data::Text::Simple' objects.
800             Value: %s
801             Reference: %s
802             Parameter 'district_name' must be a array.
803             Value: %s
804             Reference: %s
805             Parameter 'district_name' with array must contain 'Data::Text::Simple' objects.
806             Value: %s
807             Reference: %s
808             Parameter 'momc_name' must be a array.
809             Value: %s
810             Reference: %s
811             Parameter 'momc_name' with array must contain 'Data::Text::Simple' objects.
812             Value: %s
813             Reference: %s
814             Parameter 'mop_name' must be a array.
815             Value: %s
816             Reference: %s
817             Parameter 'mop_name' with array must contain 'Data::Text::Simple' objects.
818             Value: %s
819             Reference: %s
820             Parameter 'municipality_name' must be a array.
821             Value: %s
822             Reference: %s
823             Parameter 'municipality_name' with array must contain 'Data::Text::Simple' objects.
824             Value: %s
825             Reference: %s
826             Parameter 'municipality_part_name' must be a array.
827             Value: %s
828             Reference: %s
829             Parameter 'municipality_part_name' with array must contain 'Data::Text::Simple' objects.
830             Value: %s
831             Reference: %s
832             Parameter 'street_name' must be a array.
833             Value: %s
834             Reference: %s
835             Parameter 'street_name' with array must contain 'Data::Text::Simple' objects.
836             Value: %s
837             Reference: %s
838             Parameter 'text' must be a array.
839             Value: %s
840             Reference: %s
841             Parameter 'text' with array must contain 'Data::Text::Simple' objects.
842             Value: %s
843             Reference: %s
844             Parameter 'vusc_name' must be a array.
845             Value: %s
846             Reference: %s
847             Parameter 'vusc_name' with array must contain 'Data::Text::Simple' objects.
848             Value: %s
849             Reference: %s
850              
851             From Mo::utils::check_length_fix():
852             Parameter 'psc' has length different than '%s'.
853             Value: %s
854              
855             From Mo::utils::check_regexp():
856             Parameter 'address_place' does not match the specified regular expression.
857             String: %s
858             Regexp: (?^:^https://linked\.cuzk\.cz/resource/ruian/adresni-misto/\d+$)
859             Parameter 'cadastral_area' does not match the specified regular expression.
860             String: %s
861             Regexp: (?^:^https://linked\.cuzk\.cz/resource/ruian/katastralni-uzemi/\d+$)
862             Parameter 'district' does not match the specified regular expression.
863             String: %s
864             Regexp: (?^:^https://linked\.cuzk\.cz/resource/ruian/okres/\d+)
865             Parameter 'element_ruian' does not match the specified regular expression.
866             String: %s
867             Regexp: (?^:^https://linked\.cuzk\.cz/resource/ruian/parcela/\d+$)
868             Parameter 'momc' does not match the specified regular expression.
869             String: %s
870             Regexp: (?^:^https://linked\.cuzk\.cz/resource/ruian/momc/\d+$)
871             Parameter 'mop' does not match the specified regular expression.
872             String: %s
873             Regexp: (?^:^https://linked\.cuzk\.cz/resource/ruian/mop/\d+$)
874             Parameter 'municipality' does not match the specified regular expression.
875             String: %s
876             Regexp: (?^:^https://linked\.cuzk\.cz/resource/ruian/obec/\d+$)
877             Parameter 'municipality_part' does not match the specified regular expression.
878             String: %s
879             Regexp: (?^:^https://linked\.cuzk\.cz/resource/ruian/cast-obce/\d+$)
880             Parameter 'psc' does not match the specified regular expression.
881             String: %s
882             Regexp: ^\d+$
883             Parameter 'street' does not match the specified regular expression.
884             String: %s
885             Regexp: (?^:^https://linked\.cuzk\.cz/resource/ruian/ulice/\d+$)
886             Parameter 'vusc' does not match the specified regular expression.
887             String: %s
888             Regexp: (?^:^https://linked\.cuzk\.cz/resource/ruian/vusc/\d+$)
889              
890             From Mo::utils::check_strings():
891             Parameter 'house_number_type' must be one of defined strings.
892             String: %s
893             Possible strings: 'č.p.', 'č.ev.'
894              
895             From Mo::utils::Number::check_positive_natural():
896             Parameter 'address_place_code' must be a positive natural number.
897             Value: %s
898             Parameter 'conscription_number' must be a positive natural number.
899             Value: %s
900             Parameter 'house_number' must be a positive natural number.
901             Value: %s
902             Parameter 'id' must be a positive natural number.
903             Value: %s
904              
905             =head1 EXAMPLE
906              
907             =for comment filename=create_and_print_ofn_address.pl
908              
909             use strict;
910             use warnings;
911              
912             use Data::OFN::Address;
913             use Data::Text::Simple;
914             use Unicode::UTF8 qw(decode_utf8 encode_utf8);
915              
916             my $obj = Data::OFN::Address->new(
917             'address_place' => 'https://linked.cuzk.cz/resource/ruian/adresni-misto/83163832',
918             'address_place_code' => 83163832,
919             'cadastral_area' => 'https://linked.cuzk.cz/resource/ruian/katastralni-uzemi/635448',
920             'cadastral_area_name' => [
921             Data::Text::Simple->new(
922             'lang' => 'cs',
923             'text' => 'Fulnek',
924             ),
925             ],
926             'conscription_number' => 123,
927             'conscription_number_flag' => 'a',
928             'district' => 'https://linked.cuzk.cz/resource/ruian/okres/3804',
929             'district_name' => [
930             Data::Text::Simple->new(
931             'lang' => 'cs',
932             'text' => decode_utf8('Nový Jičín'),
933             ),
934             ],
935             'element_ruian' => 'https://linked.cuzk.cz/resource/ruian/parcela/91188411010',
936             'house_number' => 386,
937             'house_number_type' => decode_utf8('č.p.'),
938             'id' => 7,
939             'municipality' => 'https://linked.cuzk.cz/resource/ruian/obec/599352',
940             'municipality_name' => [
941             Data::Text::Simple->new(
942             'lang' => 'cs',
943             'text' => 'Fulnek',
944             ),
945             ],
946             'municipality_part' => 'https://linked.cuzk.cz/resource/ruian/cast-obce/413551',
947             'municipality_part_name' => [
948             Data::Text::Simple->new(
949             'lang' => 'cs',
950             'text' => 'Fulnek',
951             ),
952             ],
953             'psc' => 74245,
954             'street' => 'https://linked.cuzk.cz/resource/ruian/ulice/309184',
955             'street_name' => [
956             Data::Text::Simple->new(
957             'lang' => 'cs',
958             'text' => decode_utf8('Bílovecká'),
959             ),
960             ],
961             'text' => [
962             Data::Text::Simple->new(
963             'lang' => 'cs',
964             'text' => decode_utf8('Bílovecká 386, 74245 Fulnek'),
965             ),
966             ],
967             'vusc' => 'https://linked.cuzk.cz/resource/ruian/vusc/132',
968             'vusc_name' => [
969             Data::Text::Simple->new(
970             'lang' => 'cs',
971             'text' => decode_utf8('Moravskoslezský kraj'),
972             ),
973             ],
974             );
975              
976             sub _text {
977             my $obj = shift;
978              
979             return encode_utf8($obj->text.' ('.$obj->lang.')');
980             }
981              
982             # Print out.
983             print 'Address place: '.$obj->address_place."\n";
984             print 'Address place code: '.$obj->address_place_code."\n";
985             print 'Cadastral area: '.$obj->cadastral_area."\n";
986             print 'Cadastral area name: '._text($obj->cadastral_area_name->[0])."\n";
987             print 'Conscription number: '.$obj->conscription_number."\n";
988             print 'Conscription number flag: '.$obj->conscription_number_flag."\n";
989             print 'District: '.$obj->district."\n";
990             print 'District name: '._text($obj->district_name->[0])."\n";
991             print 'Element RUIAN: '.$obj->element_ruian."\n";
992             print 'House number: '.$obj->house_number."\n";
993             print 'House number type: '.encode_utf8($obj->house_number_type)."\n";
994             print 'Id: '.$obj->id."\n";
995             print 'Municipality: '.$obj->municipality."\n";
996             print 'Municipality name: '._text($obj->municipality_name->[0])."\n";
997             print 'Municipality part: '.$obj->municipality_part."\n";
998             print 'Municipality part name: '._text($obj->municipality_part_name->[0])."\n";
999             print 'PSC: '.$obj->psc."\n";
1000             print 'Street: '.$obj->street."\n";
1001             print 'Street name: '._text($obj->street_name->[0])."\n";
1002             print 'Text: '._text($obj->text->[0])."\n";
1003             print 'VUSC: '.$obj->vusc."\n";
1004             print 'VUSC name: '._text($obj->vusc_name->[0])."\n";
1005              
1006             # Output:
1007             # Address place: https://linked.cuzk.cz/resource/ruian/adresni-misto/83163832
1008             # Address place code: 83163832
1009             # Cadastral area: https://linked.cuzk.cz/resource/ruian/katastralni-uzemi/635448
1010             # Cadastral area name: Fulnek (cs)
1011             # Conscription number: 123
1012             # Conscription number flag: a
1013             # District: https://linked.cuzk.cz/resource/ruian/okres/3804
1014             # District name: Nový Jičín (cs)
1015             # Element RUIAN: https://linked.cuzk.cz/resource/ruian/parcela/91188411010
1016             # House number: 386
1017             # House number type: č.p.
1018             # Id: 7
1019             # Municipality: https://linked.cuzk.cz/resource/ruian/obec/599352
1020             # Municipality name: Fulnek (cs)
1021             # Municipality part: https://linked.cuzk.cz/resource/ruian/cast-obce/413551
1022             # Municipality part name: Fulnek (cs)
1023             # PSC: 74245
1024             # Street: https://linked.cuzk.cz/resource/ruian/ulice/309184
1025             # Street name: Bílovecká (cs)
1026             # Text: Bílovecká 386, 74245 Fulnek (cs)
1027             # VUSC: https://linked.cuzk.cz/resource/ruian/vusc/132
1028             # VUSC name: Moravskoslezský kraj (cs)
1029              
1030             =head1 DEPENDENCIES
1031              
1032             L<Error::Pure>
1033             L<Mo>,
1034             L<Mo::utils>,
1035             L<Mo::utils::Array>,
1036             L<Mo::utils::Number>,
1037             L<Readonly>,
1038             L<Unicode::UTF8>.
1039              
1040             =head1 REPOSITORY
1041              
1042             L<https://github.com/michal-josef-spacek/Data-OFN-Address>
1043              
1044             =head1 AUTHOR
1045              
1046             Michal Josef Špaček L<mailto:skim@cpan.org>
1047              
1048             L<http://skim.cz>
1049              
1050             =head1 LICENSE AND COPYRIGHT
1051              
1052             © 2023-2025 Michal Josef Špaček
1053              
1054             BSD 2-Clause License
1055              
1056             =head1 VERSION
1057              
1058             0.02
1059              
1060             =cut