File Coverage

lib/Locale/Unicode/Data.pm
Criterion Covered Total %
statement 744 1303 57.1
branch 247 654 37.7
condition 201 658 30.5
subroutine 191 257 74.3
pod 154 160 96.2
total 1537 3032 50.6


line stmt bran cond sub pod time code
1             ##----------------------------------------------------------------------------
2             ## Unicode Locale Identifier - ~/lib/Locale/Unicode/Data.pm
3             ## Version v1.8.0
4             ## Copyright(c) 2026 DEGUEST Pte. Ltd.
5             ## Author: Jacques Deguest <jack@deguest.jp>
6             ## Created 2024/06/15
7             ## Modified 2026/03/19
8             ## All rights reserved
9             ##
10             ##
11             ## This program is free software; you can redistribute it and/or modify it
12             ## under the same terms as Perl itself.
13             ##----------------------------------------------------------------------------
14             package Locale::Unicode::Data;
15             BEGIN
16             {
17 5     5   849578 use v5.10.1;
  5         19  
18 5     5   33 use strict;
  5         8  
  5         237  
19 5     5   45 use warnings;
  5         11  
  5         370  
20 5     5   49 use warnings::register;
  5         33  
  5         565  
21 5         525 use vars qw(
22             $ERROR $VERSION $DEBUG $FATAL_EXCEPTIONS
23             $CLDR_VERSION $DB_FILE $DBH $STHS
24 5     5   81 );
  5         9  
25 5     5   1027 use version;
  5         4136  
  5         32  
26 5     5   450 use Exporter ();
  5         9  
  5         136  
27 5     5   3563 use DBD::SQLite;
  5         94722  
  5         239  
28 5     5   33 use DBI qw( :sql_types );
  5         8  
  5         1983  
29 5     5   3495 use Encode ();
  5         110087  
  5         303  
30 5     5   44 use File::Spec;
  5         8  
  5         182  
31 5     5   5864 use JSON;
  5         83878  
  5         35  
32 5     5   12143 use Locale::Unicode v0.3.5;
  5         185791  
  5         677  
33 5     5   61 use Scalar::Util ();
  5         13  
  5         154  
34 5     5   59 use Wanted;
  5         18  
  5         710  
35             use constant {
36 5 50       1110 HAS_CONSTANTS => ( version->parse( $DBD::SQLite::VERSION ) >= 1.48 ? 1 : 0 ),
    50          
37             MISSING_AUTO_UTF8_DECODING => ( version->parse( $DBD::SQLite::VERSION ) < 1.68 ? 1 : 0 ),
38 5     5   37 };
  5         7  
39 5     5   18 our $CLDR_VERSION = '48.2';
40 5         10 our $DBH = {};
41 5         9 our $STHS = {};
42 5         144 our $VERSION = 'v1.8.0';
43             };
44              
45 5     5   32 use strict;
  5         8  
  5         153  
46 5     5   22 use warnings;
  5         8  
  5         45276  
47              
48             {
49             my( $vol, $parent, $file ) = File::Spec->splitpath(__FILE__);
50             $DB_FILE = File::Spec->catpath( $vol, $parent, 'unicode_cldr.sqlite3' );
51             unless( File::Spec->file_name_is_absolute( $DB_FILE ) )
52             {
53             $DB_FILE = File::Spec->rel2abs( $DB_FILE );
54             }
55             }
56              
57             sub new
58             {
59 4     4 1 802995 my $this = shift( @_ );
60 4   33     33 my $self = bless( {} => ( ref( $this ) || $this ) );
61 4         30 $self->{datafile} = $DB_FILE;
62 4         12 $self->{decode_sql_arrays} = 1;
63 4         13 $self->{extend_timezones_cities} = 1;
64 4   50     27 $self->{fatal} = ( $FATAL_EXCEPTIONS // 0 );
65 4         11 my @args = @_;
66 4 50 33     37 if( scalar( @args ) == 1 &&
    50 33        
67             defined( $args[0] ) &&
68             ref( $args[0] ) eq 'HASH' )
69             {
70 0         0 my $opts = shift( @args );
71 0         0 @args = %$opts;
72             }
73             elsif( ( scalar( @args ) % 2 ) )
74             {
75 0         0 return( $self->error( sprintf( "Uneven number of parameters provided (%d). Should receive key => value pairs. Parameters provided are: %s", scalar( @args ), join( ', ', @args ) ) ) );
76             }
77              
78 4         53 for( my $i = 0; $i < scalar( @args ); $i += 2 )
79             {
80 1 50       3 if( $args[$i] eq 'fatal' )
81             {
82 1         2 $self->{fatal} = $args[$i + 1];
83 1         1 last;
84             }
85             }
86              
87             # Then, if the user provided with an hash or hash reference of options, we apply them
88 4         17 for( my $i = 0; $i < scalar( @args ); $i++ )
89             {
90 1         2 my $name = $args[ $i ];
91 1         1 my $val = $args[ ++$i ];
92 1         9 my $meth = $self->can( $name );
93 1 50       9 if( !defined( $meth ) )
    50          
94             {
95 0         0 return( $self->error( "Unknown method \"${meth}\" provided." ) );
96             }
97             elsif( !defined( $meth->( $self, $val ) ) )
98             {
99 0 0 0     0 if( defined( $val ) && $self->error )
100             {
101 0         0 return( $self->pass_error );
102             }
103             }
104             }
105              
106 4   50     25 my $file = $self->{datafile} || return( $self->error( "No SQLite data file set." ) );
107 4   50     28 my $dbh = $self->_dbh || return( $self->pass_error );
108 4         13 $self->{_dbh} = $dbh;
109              
110 4         22 return( $self );
111             }
112              
113             sub alias { return( shift->_fetch_one({
114 48     48 1 135254 id => 'get_alias',
115             field => 'alias',
116             table => 'aliases',
117             requires => [qw( type )],
118             has_array => [qw( replacement )],
119             }, @_ ) ); }
120              
121             sub aliases { return( shift->_fetch_all({
122 7     7 1 23931 id => 'aliases',
123             table => 'aliases',
124             by => [qw( type )],
125             has_array => [qw( replacement )],
126             }, @_ ) ); }
127              
128             sub annotation { return( shift->_fetch_one({
129 1     1 1 11564 id => 'get_annotation',
130             field => 'annotation',
131             table => 'annotations',
132             requires => [qw( locale )],
133             has_array => [qw( defaults )],
134             }, @_ ) ); }
135              
136             sub annotations { return( shift->_fetch_all({
137 2     2 1 381944 id => 'annotations',
138             table => 'annotations',
139             by => [qw( locale )],
140             has_array => [qw( defaults )],
141             }, @_ ) ); }
142              
143             sub bcp47_currency { return( shift->_fetch_one({
144 1     1 1 21026 id => 'get_bcp47_currency',
145             field => 'currid',
146             table => 'bcp47_currencies',
147             }, @_ ) ); }
148              
149             sub bcp47_currencies { return( shift->_fetch_all({
150 3     3 1 8085 id => 'bcp47_currencies',
151             table => 'bcp47_currencies',
152             by => [qw( code is_obsolete )],
153             }, @_ ) ); }
154              
155             sub bcp47_extension { return( shift->_fetch_one({
156 1     1 1 4477 id => 'get_bcp47_extension',
157             field => 'extension',
158             table => 'bcp47_extensions',
159             }, @_ ) ); }
160              
161             sub bcp47_extensions { return( shift->_fetch_all({
162 3     3 1 8856 id => 'bcp47_extensions',
163             table => 'bcp47_extensions',
164             by => [qw( extension deprecated )],
165             }, @_ ) ); }
166              
167             sub bcp47_timezone { return( shift->_fetch_one({
168 1     1 1 4404 id => 'get_bcp47_timezone',
169             field => 'tzid',
170             table => 'bcp47_timezones',
171             has_array => [qw( alias )],
172             }, @_ ) ); }
173              
174             sub bcp47_timezones { return( shift->_fetch_all({
175 2     2 1 7876 id => 'bcp47_timezones',
176             table => 'bcp47_timezones',
177             by => [qw( deprecated )],
178             has_array => [qw( alias )],
179             }, @_ ) ); }
180              
181             sub bcp47_value { return( shift->_fetch_one({
182 1     1 1 6554 id => 'get_bcp47_value',
183             field => 'value',
184             table => 'bcp47_values',
185             }, @_ ) ); }
186              
187             sub bcp47_values { return( shift->_fetch_all({
188 3     3 1 15143 id => 'bcp47_values',
189             table => 'bcp47_values',
190             by => [qw( category extension )],
191             }, @_ ) ); }
192              
193             sub calendar { return( shift->_fetch_one({
194 1     1 1 9088 id => 'get_calendar',
195             field => 'calendar',
196             table => 'calendars',
197             }, @_ ) ); }
198              
199             sub calendars { return( shift->_fetch_all({
200 3     3 1 112296 id => 'calendars',
201             table => 'calendars',
202             by => [qw( calendar system inherits )],
203             }, @_ ) ); }
204              
205             sub calendar_append_format { return( shift->_fetch_one({
206 1     1 1 7869 id => 'get_calendar_append_format',
207             field => 'format_id',
208             table => 'calendar_append_formats',
209             requires => [qw( locale calendar )],
210             }, @_ ) ); }
211              
212             sub calendar_append_formats { return( shift->_fetch_all({
213 4     4 1 16741 id => 'calendar_append_formats',
214             table => 'calendar_append_formats',
215             by => [qw( locale calendar )],
216             }, @_ ) ); }
217              
218             sub calendar_available_format { return( shift->_fetch_one({
219 1     1 1 7841 id => 'get_calendar_available_format',
220             field => 'format_id',
221             table => 'calendar_available_formats',
222             requires => [qw( locale calendar count alt )],
223             default => { count => undef, alt => undef },
224             }, @_ ) ); }
225              
226             sub calendar_available_formats { return( shift->_fetch_all({
227 4     4 1 68274 id => 'calendar_available_formats',
228             table => 'calendar_available_formats',
229             by => [qw( locale calendar count alt )],
230             }, @_ ) ); }
231              
232             sub calendar_cyclic_l10n { return( shift->_fetch_one({
233 1     1 1 4974 id => 'get_calendar_cyclic_l10n',
234             field => 'format_id',
235             table => 'calendar_cyclics_l10n',
236             requires => [qw( locale calendar format_set format_type format_length )],
237             }, @_ ) ); }
238              
239             sub calendar_cyclics_l10n { return( shift->_fetch_all({
240 4     4 1 22767 id => 'calendar_cyclics_l10n',
241             table => 'calendar_cyclics_l10n',
242             by => [qw( locale calendar format_set format_type format_length )],
243             }, @_ ) ); }
244              
245             sub calendar_datetime_format { return( shift->_fetch_one({
246 1     1 1 5368 id => 'get_calendar_datetime_format',
247             field => 'format_type',
248             table => 'calendar_datetime_formats',
249             requires => [qw( locale calendar format_length )],
250             }, @_ ) ); }
251              
252             sub calendar_datetime_formats { return( shift->_fetch_all({
253 4     4 1 26231 id => 'calendar_datetime_formats',
254             table => 'calendar_datetime_formats',
255             by => [qw( locale calendar )],
256             }, @_ ) ); }
257              
258             sub calendar_era
259             {
260 0     0 1 0 my $self = shift( @_ );
261 0         0 my $opts = $self->_get_args_as_hash( @_ );
262 0 0       0 $opts->{calendar} || return( $self->error( "No calendar ID was provided." ) );
263 0 0       0 if( $opts->{calendar} !~ /^[a-zA-Z]+(?:\-[a-zA-Z]+)*$/ )
264             {
265 0         0 return( $self->error( "Calendar ID provided '$opts->{calendar}' contains illegal characters." ) );
266             }
267 0         0 my $sql_arrays_in = [qw( aliases )];
268 0         0 my $sth;
269 0         0 local $@;
270 0 0       0 if( $opts->{sequence} )
    0          
271             {
272 0 0 0     0 if( defined( $opts->{sequence} ) &&
273             $opts->{sequence} !~ /^\d+$/ )
274             {
275 0   0     0 return( $self->error( "The calendar era sequence provided (", ( $opts->{sequence} // 'undef' ), ") does not look like an integer." ) );
276             }
277 0 0       0 unless( $sth = $self->_get_cached_statement( 'calendar_era_with_sequence' ) )
278             {
279 0   0     0 my $dbh = $self->_dbh || return( $self->pass_error );
280             $sth = eval
281 0   0     0 {
282             $dbh->prepare( "SELECT * FROM calendar_eras WHERE calendar = ? AND sequence = ?" )
283             } || return( $self->error( "Unable to prepare SQL query to retrieve calendar era information for a given calendar and sequence: ", ( $@ || $dbh->errstr ) ) );
284 0         0 $self->_set_cached_statement( calendar_era_with_sequence => $sth );
285             }
286             eval
287 0 0 0     0 {
288 0         0 $sth->execute( @$opts{qw( calendar sequence )} )
289             } || return( $self->error( "Error executing SQL query '$sth->{Statement}' to retrieve calendar era information for a given calendar and sequence: ", ( $@ || $sth->errstr ) ) );
290             }
291             elsif( $opts->{code} )
292             {
293 0 0 0     0 if( defined( $opts->{code} ) &&
294             $opts->{code} !~ /^[a-zA-Z]+(?:\-[a-zA-Z]+)*$/ )
295             {
296 0   0     0 return( $self->error( "The calendar era code provided (", ( $opts->{code} // 'undef' ), ") contains illegal characters." ) );
297             }
298 0 0       0 unless( $sth = $self->_get_cached_statement( 'calendar_era_with_code' ) )
299             {
300 0   0     0 my $dbh = $self->_dbh || return( $self->pass_error );
301             $sth = eval
302 0   0     0 {
303             $dbh->prepare( "SELECT * FROM calendar_eras WHERE calendar = ? AND code = ?" )
304             } || return( $self->error( "Unable to prepare SQL query to retrieve calendar era information for a given calendar and code: ", ( $@ || $dbh->errstr ) ) );
305 0         0 $self->_set_cached_statement( calendar_era_with_code => $sth );
306             }
307             eval
308 0 0 0     0 {
309 0         0 $sth->execute( @$opts{qw( calendar code )} )
310             } || return( $self->error( "Error executing SQL query '$sth->{Statement}' to retrieve calendar era information for a given calendar and code: ", ( $@ || $sth->errstr ) ) );
311             }
312             else
313             {
314 0         0 return( $self->error( "No sequence or code parameter provided to retrieve specific era for calendar $opts->{calendar}" ) );
315             }
316 0         0 my $ref = $sth->fetchrow_hashref;
317 0         0 $self->_decode_utf8( $ref ) if( MISSING_AUTO_UTF8_DECODING );
318 0 0       0 $self->_decode_sql_arrays( $sql_arrays_in, $ref ) if( $self->{decode_sql_arrays} );
319 0         0 return( $ref );
320             }
321              
322             sub calendar_eras
323             {
324 0     0 1 0 my $self = shift( @_ );
325 0         0 my $opts = $self->_get_args_as_hash( @_ );
326 0         0 my $sql_arrays_in = [qw( aliases )];
327 0         0 my $sth;
328 0         0 local $@;
329 0 0       0 if( $opts->{calendar} )
330             {
331 0 0       0 unless( $sth = $self->_get_cached_statement( 'calendar_eras_with_calendar' ) )
332             {
333 0   0     0 my $dbh = $self->_dbh || return( $self->pass_error );
334             $sth = eval
335 0   0     0 {
336             $dbh->prepare( "SELECT * FROM calendar_eras WHERE calendar = ?" )
337             } || return( $self->error( "Unable to prepare SQL query to retrieve all calendar eras information for a given calendar': ", ( $@ || $dbh->errstr ) ) );
338 0         0 $self->_set_cached_statement( calendar_eras_with_calendar => $sth );
339             }
340             }
341             else
342             {
343 0 0       0 unless( $sth = $self->_get_cached_statement( 'calendar_eras' ) )
344             {
345 0   0     0 my $dbh = $self->_dbh || return( $self->pass_error );
346             $sth = eval
347 0   0     0 {
348             $dbh->prepare( "SELECT * FROM calendar_eras" )
349             } || return( $self->error( "Unable to prepare SQL query to retrieve all calendar eras information: ", ( $@ || $dbh->errstr ) ) );
350 0         0 $self->_set_cached_statement( calendar_eras => $sth );
351             }
352             }
353              
354             eval
355             {
356 0 0 0     0 $sth->execute( length( $opts->{calendar} // '' ) ? $opts->{calendar} : () )
357 0 0 0     0 } || return( $self->error( "Error executing SQL query '$sth->{Statement}' to retrieve all calendar eras". ( $opts->{calendar} ? " with calendar '$opts->{calendar}'" : '' ), ": ", ( $@ || $sth->errstr ) ) );
    0          
358 0         0 my $all = $sth->fetchall_arrayref({});
359 0         0 $self->_decode_utf8( $all ) if( MISSING_AUTO_UTF8_DECODING );
360 0 0       0 $self->_decode_sql_arrays( $sql_arrays_in, $all ) if( $self->{decode_sql_arrays} );
361 0         0 return( $all );
362             }
363              
364             sub calendar_era_l10n { return( shift->_fetch_one({
365 1     1 1 18413 id => 'get_calendar_era_l10n',
366             field => 'era_id',
367             table => 'calendar_eras_l10n',
368             requires => [qw( locale calendar era_width alt )],
369             default => { alt => undef },
370             }, @_ ) ); }
371              
372             sub calendar_eras_l10n { return( shift->_fetch_all({
373 4     4 1 48800 id => 'calendar_eras_l10n',
374             table => 'calendar_eras_l10n',
375             by => [qw( locale calendar era_width alt )],
376             order => 'era_id',
377             }, @_ ) ); }
378              
379             sub calendar_format_l10n { return( shift->_fetch_one({
380 1     1 1 5042 id => 'get_calendar_format_l10n',
381             field => 'format_length',
382             table => 'calendar_formats_l10n',
383             requires => [qw( locale calendar format_type )],
384             }, @_ ) ); }
385              
386             sub calendar_formats_l10n { return( shift->_fetch_all({
387 4     4 1 29551 id => 'calendar_formats_l10n',
388             table => 'calendar_formats_l10n',
389             by => [qw( locale calendar format_type format_length alt )],
390             }, @_ ) ); }
391              
392             sub calendar_interval_format { return( shift->_fetch_one({
393 1     1 1 8881 id => 'get_calendar_interval_format',
394             field => 'format_id',
395             table => 'calendar_interval_formats',
396             requires => [qw( locale calendar greatest_diff_id alt )],
397             default => { alt => undef },
398             }, @_ ) ); }
399              
400             sub calendar_interval_formats { return( shift->_fetch_all({
401 4     4 1 151622 id => 'calendar_interval_formats',
402             table => 'calendar_interval_formats',
403             by => [qw( locale calendar greatest_diff_id alt )],
404             }, @_ ) ); }
405              
406             sub calendar_l10n { return( shift->_fetch_one({
407 1     1 1 9019 id => 'get_calendar_l10n',
408             field => 'calendar',
409             table => 'calendars_l10n',
410             requires => [qw( locale )],
411             default => { count => undef },
412             }, @_ ) ); }
413              
414             sub calendars_l10n { return( shift->_fetch_all({
415 2     2 1 16999 id => 'calendars_l10n',
416             table => 'calendars_l10n',
417             by => [qw( locale )],
418             }, @_ ) ); }
419              
420             sub calendar_term { return( shift->_fetch_one({
421             # id => 'get_calendar_term',
422 2     2 1 23315 field => 'term_name',
423             table => 'calendar_terms',
424             requires => [qw( locale calendar term_context term_width alt yeartype )],
425             default => { alt => undef, yeartype => undef },
426             }, @_ ) ); }
427              
428             # NOTE: no calendar_term() method, because filtering would return more than one element
429             sub calendar_terms { return( shift->_fetch_all({
430 3     3 1 111841 id => 'calendars',
431             table => 'calendar_terms',
432             by => [qw( locale calendar term_type term_context term_width alt yeartype )],
433             }, @_ ) ); }
434              
435             sub casing { return( shift->_fetch_one({
436 1     1 1 9187 id => 'get_casing',
437             field => 'token',
438             table => 'casings',
439             requires => [qw( locale )],
440             }, @_ ) ); }
441              
442             sub casings { return( shift->_fetch_all({
443 2     2 1 17591 id => 'casings',
444             table => 'casings',
445             by => [qw( locale )],
446             }, @_ ) ); }
447              
448 0     0 1 0 sub cldr_built { return( shift->_get_metadata( 'built_on' ) ); }
449              
450 0     0 1 0 sub cldr_maintainer { return( shift->_get_metadata( 'maintainer' ) ); }
451              
452 1     1 1 3148 sub cldr_version { return( shift->_get_metadata( 'cldr_version' ) ); }
453              
454             sub code_mapping { return( shift->_fetch_one({
455 1     1 1 8973 id => 'get_code_mapping',
456             field => 'code',
457             table => 'code_mappings',
458             }, @_ ) ); }
459              
460             sub code_mappings { return( shift->_fetch_all({
461 7     7 1 30868 id => 'code_mappings',
462             table => 'code_mappings',
463             by => [qw( alpha3 numeric fips10 type )],
464             }, @_ ) ); }
465              
466             sub collation { return( shift->_fetch_one({
467 1     1 1 8358 id => 'get_collation',
468             field => 'collation',
469             table => 'collations',
470             }, @_ ) ); }
471              
472             sub collations { return( shift->_fetch_all({
473 2     2 1 7488 id => 'collations',
474             table => 'collations',
475             by => [qw( collation description )],
476             # Important, because this is a view, and without explicitly defining the ordering field, it would fall back to rowid, which does not exist in view and would result in a fatal exception.
477             order => 'collation',
478             }, @_ ) ); }
479              
480             sub collation_l10n { return( shift->_fetch_one({
481 1     1 1 6097 id => 'get_collation_l10n',
482             field => 'collation',
483             table => 'collations_l10n',
484             requires => [qw( locale )],
485             }, @_ ) ); }
486              
487             sub collations_l10n { return( shift->_fetch_all({
488 2     2 1 21364 id => 'collations_l10n',
489             table => 'collations_l10n',
490             by => [qw( locale collation locale_name )],
491             }, @_ ) ); }
492              
493             sub currency { return( shift->_fetch_one({
494 1     1 1 15754 id => 'get_currency',
495             field => 'currency',
496             table => 'currencies',
497             }, @_ ) ); }
498              
499             sub currencies { return( shift->_fetch_all({
500 2     2 1 43941 id => 'currencies',
501             table => 'currencies',
502             by => [qw( is_obsolete )],
503             has_status => 1,
504             }, @_ ) ); }
505              
506             sub currency_info { return( shift->_fetch_one({
507 1     1 1 8838 id => 'get_currency_info',
508             field => 'currency',
509             table => 'currencies_info',
510             requires => [qw( territory )],
511             }, @_ ) ); }
512              
513             sub currencies_info { return( shift->_fetch_all({
514 3     3 1 20170 id => 'currencies',
515             table => 'currencies_info',
516             by => [qw( territory currency )],
517             }, @_ ) ); }
518              
519             sub currency_l10n { return( shift->_fetch_one({
520 1     1 1 8681 id => 'get_currency_l10n',
521             field => 'currency',
522             table => 'currencies_l10n',
523             requires => [qw( locale count )],
524             default => { count => undef },
525             }, @_ ) ); }
526              
527             sub currencies_l10n { return( shift->_fetch_all({
528 3     3 1 170528 id => 'currencies_l10n',
529             table => 'currencies_l10n',
530             by => [qw( locale currency count )],
531             }, @_ ) ); }
532              
533 1 50   1 1 905 sub database_handler { return( Scalar::Util::blessed( $_[0] ) ? shift->{_dbh} : undef ); }
534              
535 1430     1430 1 85780 sub datafile { return( shift->_set_get_prop( 'datafile', @_ ) ); }
536              
537             sub date_field_l10n { return( shift->_fetch_one({
538 1     1 1 10641 id => 'get_date_field_l10n',
539             field => 'relative',
540             table => 'date_fields_l10n',
541             requires => [qw( locale field_type field_length )],
542             }, @_ ) ); }
543              
544             sub date_fields_l10n { return( shift->_fetch_all({
545 3     3 1 33790 id => 'date_fields_l10n',
546             table => 'date_fields_l10n',
547             by => [qw( locale field_type field_length )],
548             }, @_ ) ); }
549              
550             sub date_term { return( shift->_fetch_one({
551 0     0 1 0 id => 'get_date_term',
552             field => 'term_type',
553             table => 'date_terms',
554             requires => [qw( locale term_length )],
555             }, @_ ) ); }
556              
557             sub date_terms { return( shift->_fetch_all({
558 0     0 1 0 id => 'date_terms',
559             table => 'date_terms',
560             by => [qw( locale term_type term_length )],
561             }, @_ ) ); }
562              
563             sub day_period { return( shift->_fetch_one({
564 1     1 1 8647 id => 'get_day_period',
565             field => 'day_period',
566             table => 'day_periods',
567             requires => [qw( locale )],
568             }, @_ ) ); }
569              
570             sub day_periods { return( shift->_fetch_all({
571 3     3 1 15183 id => 'day_periods',
572             table => 'day_periods',
573             by => [qw( locale day_period )],
574             }, @_ ) ); }
575              
576             sub decode_sql_arrays { return( shift->_set_get_prop({
577 0     0 1 0 field => 'decode_sql_arrays',
578             type => 'boolean',
579             }, @_ ) ); }
580              
581             sub error
582             {
583 3     3 1 636 my $self = shift( @_ );
584 3 100       10 if( @_ )
585             {
586 1 50       4 my $msg = join( '', map( ( ref( $_ ) eq 'CODE' ) ? $_->() : $_, @_ ) );
587 1         12 $self->{error} = $ERROR = Locale::Unicode::Data::Exception->new({
588             skip_frames => 1,
589             message => $msg,
590             });
591 1 50       3 if( $self->fatal )
592             {
593 1         6 die( $self->{error} );
594             }
595             else
596             {
597 0 0       0 warn( $msg ) if( warnings::enabled() );
598 0 0       0 rreturn( Locale::Unicode::Data::NullObject->new ) if( want( 'OBJECT' ) );
599 0         0 return;
600             }
601             }
602 2 50       11 return( ref( $self ) ? $self->{error} : $ERROR );
603             }
604              
605             sub extend_timezones_cities { return( shift->_set_get_prop({
606 2     2 1 22 field => 'extend_timezones_cities',
607             type => 'boolean',
608             }, @_ ) ); }
609              
610 2     2 1 10 sub fatal { return( shift->_set_get_prop( 'fatal', @_ ) ); }
611              
612             sub interval_formats
613             {
614 0     0 1 0 my $self = shift( @_ );
615 0         0 my $opts = $self->_get_args_as_hash( @_ );
616             my $locale = $opts->{locale} ||
617 0   0     0 return( $self->error( "No locale provided to get all the interval formats." ) );
618             my $cal_id = $opts->{calendar} ||
619 0   0     0 return( $self->error( "No calendar ID provided to get all the interval formats." ) );
620 0   0     0 my $all = $self->calendar_interval_formats(
621             locale => $locale,
622             calendar => $cal_id,
623             ) || return( $self->pass_error );
624 0         0 my $formats = {};
625 0         0 foreach my $ref ( @$all )
626             {
627 0   0     0 $formats->{ $ref->{format_id} } ||= [];
628 0         0 push( @{$formats->{ $ref->{format_id} }}, $ref->{greatest_diff_id} );
  0         0  
629             }
630 0         0 return( $formats );
631             }
632              
633             sub l10n
634             {
635 19     19 1 282773 my $self = shift( @_ );
636 19         105 my $opts = $self->_get_args_as_hash( @_ );
637 19   50     176 my $type = $opts->{type} || return( $self->error( "No localisation type was provided." ) );
638 19         1193 my $type_to_table =
639             {
640             annotation =>
641             {
642             table => 'annotations',
643             field => 'annotation',
644             has_array => [qw( defaults )],
645             },
646             calendar_append_format =>
647             {
648             table => 'calendar_append_formats',
649             field => 'format_id',
650             requires => [qw( locale calendar )],
651             },
652             calendar_available_format =>
653             {
654             table => 'calendar_available_formats',
655             field => 'format_id',
656             requires => [qw( locale calendar )],
657             },
658             calendar_cyclic =>
659             {
660             table => 'calendar_cyclics_l10n',
661             field => 'format_id',
662             requires => [qw( locale calendar format_set )],
663             },
664             calendar_era =>
665             {
666             table => 'calendar_eras_l10n',
667             field => 'era_id',
668             requires => [qw( locale calendar era_width )],
669             },
670             calendar_format =>
671             {
672             table => 'calendar_formats_l10n',
673             field => 'format_id',
674             requires => [qw( locale calendar )],
675             },
676             calendar_interval_format =>
677             {
678             table => 'calendar_interval_formats',
679             field => 'format_id',
680             requires => [qw( locale calendar )],
681             },
682             calendar_term =>
683             {
684             table => 'calendar_terms',
685             field => 'term_name',
686             requires => [qw( locale calendar )],
687             },
688             casing =>
689             {
690             table => 'casings',
691             field => 'token',
692             },
693             currency =>
694             {
695             table => 'currencies_l10n',
696             field => 'currency',
697             },
698             date_field =>
699             {
700             table => 'date_fields_l10n',
701             field => 'relative',
702             requires => [qw( locale field_type )],
703             },
704             locale =>
705             {
706             table => 'locales_l10n',
707             field => 'locale_id',
708             },
709             number_format =>
710             {
711             table => 'number_formats_l10n',
712             field => 'format_id',
713             requires => [qw( locale number_type )],
714             },
715             number_symbol =>
716             {
717             table => 'number_symbols_l10n',
718             field => 'property',
719             },
720             script =>
721             {
722             table => 'scripts_l10n',
723             field => 'script',
724             },
725             subdivision =>
726             {
727             table => 'subdivisions_l10n',
728             field => 'subdivision',
729             },
730             territory =>
731             {
732             table => 'territories_l10n',
733             field => 'territory',
734             },
735             unit =>
736             {
737             table => 'units_l10n',
738             field => 'unit_id',
739             },
740             variant =>
741             {
742             table => 'variants_l10n',
743             field => 'variant',
744             },
745             };
746 19         131 $type_to_table->{era} = $type_to_table->{calendar_era};
747 19         57 $type_to_table->{available} = $type_to_table->{calendar_available_format};
748 19         116 $type_to_table->{append} = $type_to_table->{calendar_append_format};
749 19         57 $type_to_table->{cyclic} = $type_to_table->{calendar_cyclics_l10n};
750 19         57 $type_to_table->{field} = $type_to_table->{date_field};
751 19         44 $type_to_table->{interval} = $type_to_table->{calendar_interval_format};
752 19         53 $type_to_table->{symbol} = $type_to_table->{number_symbol};
753 19 50       86 if( !exists( $type_to_table->{ $type } ) )
754             {
755 0         0 return( $self->error( "Unknown localisation type '${type}'" ) );
756             }
757 19         63 my $table = $type_to_table->{ $type }->{table};
758 19         50 my $field = $type_to_table->{ $type }->{field};
759 19         45 my $key;
760 19 50       134 if( exists( $opts->{key} ) )
    50          
761             {
762 0         0 $key = $opts->{key};
763             }
764             elsif( exists( $opts->{ $field } ) )
765             {
766 19         61 $key = $opts->{ $field };
767             }
768 19 50 50     207 return( $self->error( "No localisation key was provided." ) ) if( !defined( $key ) || !length( $key // '' ) );
      33        
769             my $requires = exists( $type_to_table->{ $type }->{requires} )
770             ? $type_to_table->{ $type }->{requires}
771 19 100       99 : [qw( locale )];
772 19         61 foreach( @$requires )
773             {
774 30 50 33     373 if( !exists( $opts->{ $_ } ) ||
      50        
      33        
775             !defined( $opts->{ $_ } ) ||
776             !length( $opts->{ $_ } // '' ) )
777             {
778 0         0 return( $self->error( "No value provided for argument '$_' to retrieve localised data from table ${table}" ) );
779             }
780             }
781 19         48 local $@;
782 19         38 my $sth;
783 19 50       140 my $sth_id = "l10n_${table}" . ( scalar( @$requires ) ? '_' . join( '_', @$requires ) : '' );
784 19 50       97 unless( $sth = $self->_get_cached_statement( $sth_id ) )
785             {
786 19   50     92 my $dbh = $self->_dbh || return( $self->pass_error );
787             $sth = eval
788 19   50     100 {
789             $dbh->prepare( "SELECT * FROM ${table} WHERE ${field} = ?" . ( scalar( @$requires ) ? ' AND ' . join( ' AND ', map( "$_ = ?", @$requires ) ) : '' ) . ' ORDER BY rowid' );
790             } || return( $self->error( "Unable to prepare SQL query to retrieve data from the table ${table} with field ${field}: ", ( $@ || $dbh->errstr ) ) );
791 19         3989 $self->_set_cached_statement( $sth_id => $sth );
792             }
793             eval
794             {
795 19         29508 $sth->execute( $key, @$opts{ @$requires } );
796 19 50 0     59 } || return( $self->error( "Error executing SQL statement to retrieve data from the table ${table} with field ${field} and arguments '", join( "', '", @$requires ), "': ", ( $@ || $sth->errstr ), " with SQL query: ", $sth->{Statement} ) );
797 19         312 my $all = $sth->fetchall_arrayref({});
798 19         3421 $self->_decode_utf8( $all ) if( MISSING_AUTO_UTF8_DECODING );
799 19 50 66     134 if( exists( $type_to_table->{ $type }->{has_array} ) &&
800             $self->{decode_sql_arrays} )
801             {
802 1         7 $self->_decode_sql_arrays( $type_to_table->{ $type }->{has_array}, $all );
803             }
804 19         522 return( $all );
805             }
806              
807             sub language { return( shift->_fetch_one({
808 1     1 1 34531 id => 'get_language',
809             field => 'language',
810             table => 'languages',
811             has_array => [qw( scripts territories )],
812             }, @_ ) ); }
813              
814             sub languages { return( shift->_fetch_all({
815 2     2 1 30173 id => 'languages',
816             table => 'languages',
817             by => [qw( parent alt )],
818             has_status => 1,
819             has_array => [qw( scripts territories )],
820             }, @_ ) ); }
821              
822             sub language_population { return( shift->_fetch_one({
823 0     0 1 0 id => 'get_language_population',
824             field => 'territory',
825             table => 'language_population',
826             multi => 1,
827             }, @_ ) ); }
828              
829             sub language_populations { return( shift->_fetch_all({
830 0     0 1 0 id => 'language_population',
831             table => 'language_population',
832             has_status => 'official_status',
833             }, @_ ) ); }
834              
835             sub likely_subtag { return( shift->_fetch_one({
836 5     5 1 6901 id => 'get_likely_subtags',
837             field => 'locale',
838             table => 'likely_subtags',
839             }, @_ ) ); }
840              
841             sub likely_subtags { return( shift->_fetch_all({
842 1     1 1 4448 id => 'likely_subtags',
843             table => 'likely_subtags',
844             }, @_ ) ); }
845              
846             sub locale { return( shift->_fetch_one({
847 451     451 1 18600 id => 'get_locale',
848             field => 'locale',
849             table => 'locales',
850             has_array => [qw( collations )],
851             }, @_ ) ); }
852              
853             sub locales { return( shift->_fetch_all({
854 1     1 1 4581 id => 'locales',
855             table => 'locales',
856             has_status => 1,
857             has_array => [qw( collations )],
858             }, @_ ) ); }
859              
860             sub locale_l10n { return( shift->_fetch_one({
861 1     1 1 9187 id => 'get_locale_l10n',
862             field => 'locale_id',
863             table => 'locales_l10n',
864             requires => [qw( locale alt )],
865             default => { alt => undef },
866             }, @_ ) ); }
867              
868             sub locales_l10n { return( shift->_fetch_all({
869 4     4 1 130709 id => 'locales_l10n',
870             table => 'locales_l10n',
871             by => [qw( locale locale_id alt )],
872             }, @_ ) ); }
873              
874             sub locales_info { return( shift->_fetch_one({
875 1     1 1 23474 id => 'get_locales_info',
876             field => 'property',
877             table => 'locales_info',
878             requires => [qw( locale )],
879             }, @_ ) ); }
880              
881             sub locales_infos { return( shift->_fetch_all({
882 1     1 1 8082 id => 'locales_info',
883             table => 'locales_info',
884             }, @_ ) ); }
885              
886             sub locale_number_system { return( shift->_fetch_one({
887 0     0 1 0 id => 'get_locale_number_system',
888             field => 'locale',
889             table => 'locale_number_systems',
890             requires => [qw()],
891             }, @_ ) ); }
892              
893             sub locale_number_systems { return( shift->_fetch_all({
894 0     0 1 0 id => 'locale_number_systems',
895             table => 'locale_number_systems',
896             by => [qw( number_system native traditional finance )],
897             }, @_ ) ); }
898              
899             # <https://unicode.org/reports/tr35/tr35.html#Locale_Inheritance>
900             sub make_inheritance_tree
901             {
902 444     444 1 374066 my $self = shift( @_ );
903 444   50     1676 my $locale = $self->_locale_object( shift( @_ ) ) ||
904             return( $self->pass_error );
905 444   50     3805 $locale = $self->_locale_object( $locale->clone->base ) ||
906             return( $self->pass_error );
907 444         7680 my $tree = ["$locale"];
908 444         2129391 my $ref;
909 444 100 100     2451 if( ( $ref = $self->locale( locale => $locale ) ) &&
910             $ref->{parent} )
911             {
912 9   50     138 my $tree2 = $self->make_inheritance_tree( $ref->{parent} ) || return( $self->pass_error );
913 9         48 push( @$tree, @$tree2 );
914 9         212 return( $tree );
915             }
916              
917             # The locale has something like en-Latn-US, we need to save in the tree en-US
918 435 50 33     2770 if( $locale->territory && ( $locale->script || $locale->variant ) )
      66        
919             {
920 0         0 my $clone = $locale->clone;
921 0         0 $clone->script( undef );
922 0         0 $clone->variant( undef );
923 0         0 push( @$tree, "$clone" );
924 0 0 0     0 if( ( $ref = $self->locale( locale => $clone ) ) &&
925             $ref->{parent} )
926             {
927 0   0     0 my $tree2 = $self->make_inheritance_tree( $ref->{parent} ) || return( $self->pass_error );
928 0         0 push( @$tree, @$tree2 );
929 0         0 return( $tree );
930             }
931             }
932              
933             # "The default search chain is slighly different for multiple variants. In that case, the inheritance chain covers all combinations of variants, with longest number of variants first, and otherwise in alphabetical order."
934             # Check if there are more than one variants, in which case, we add each variation by removing one variant at each iteration
935 435         108505 my $variants = $locale->variants;
936 435 50       41519 if( scalar( @$variants ) )
937             {
938 0 0       0 if( scalar( @$variants ) > 1 )
939             {
940 0         0 local $" = '-';
941 0         0 my $seen = { "@$variants" => 1 };
942             # We use permutation to produce all possible combinations
943             # Credits: <https://stackoverflow.com/questions/10299961/in-perl-how-can-i-generate-all-possible-combinations-of-a-list>
944 0         0 my $permute;
945             $permute = sub
946             {
947 0     0   0 my( $list, $n ) = @_;
948 0 0       0 return( map( [$_], @$list ) ) if( $n <= 1 );
949 0         0 my @comb;
950 0         0 for my $i ( 0 .. $#$list )
951             {
952 0         0 my @rest = @$list;
953 0         0 my $val = splice( @rest, $i, 1 );
954 0         0 push( @comb, [$val, @$_] ) for( $permute->( \@rest, $n - 1 ) );
955             }
956 0         0 return( @comb );
957 0         0 };
958              
959 0         0 while( scalar( @$variants ) )
960             {
961 0         0 my @variations = $permute->( $variants, scalar( @$variants ) );
962 0         0 foreach my $ref ( @variations )
963             {
964 0 0       0 if( scalar( keys( %$seen ) ) )
965             {
966             # We skip the default set of variants that have been tested at the start.
967 0 0       0 if( exists( $seen->{ "@$ref" } ) )
968             {
969 0         0 delete( $seen->{ "@$ref" } );
970 0         0 next;
971             }
972             }
973 0         0 $locale->variant( "@$ref" );
974 0         0 push( @$tree, "$locale" );
975             }
976 0         0 pop( @$variants );
977             }
978             }
979              
980 0         0 $locale->variant( undef );
981 0         0 push( @$tree, "$locale" );
982 0 0 0     0 if( ( $ref = $self->locale( locale => $locale ) ) &&
983             $ref->{parent} )
984             {
985 0   0     0 my $tree2 = $self->make_inheritance_tree( $ref->{parent} ) || return( $self->pass_error );
986 0         0 push( @$tree, @$tree2 );
987 0         0 return( $tree );
988             }
989             }
990            
991 435 100       1269 if( $locale->territory )
992             {
993 6         866 $locale->territory( undef );
994 6         2794 push( @$tree, "$locale" );
995 6 50 33     32962 if( ( $ref = $self->locale( locale => $locale ) ) &&
996             $ref->{parent} )
997             {
998 0   0     0 my $tree2 = $self->make_inheritance_tree( $ref->{parent} ) || return( $self->pass_error );
999 0         0 push( @$tree, @$tree2 );
1000 0         0 return( $tree );
1001             }
1002             }
1003              
1004 435 50       88284 if( $locale->script )
1005             {
1006 0         0 $locale->script( undef );
1007 0         0 push( @$tree, "$locale" );
1008 0 0 0     0 if( ( $ref = $self->locale( locale => $locale ) ) &&
1009             $ref->{parent} )
1010             {
1011 0   0     0 my $tree2 = $self->make_inheritance_tree( $ref->{parent} ) || return( $self->pass_error );
1012 0         0 push( @$tree, @$tree2 );
1013 0         0 return( $tree );
1014             }
1015             }
1016             # Make sure our last resort is not the same as our initial value
1017             # For example: fr -> fr
1018 435 50       39044 if( !scalar( grep( $_ eq $locale, @$tree ) ) )
1019             {
1020 0         0 push( @$tree, "$locale" );
1021 0 0 0     0 if( ( $ref = $self->locale( locale => $locale ) ) &&
1022             $ref->{parent} )
1023             {
1024 0   0     0 my $tree2 = $self->make_inheritance_tree( $ref->{parent} ) || return( $self->pass_error );
1025 0         0 push( @$tree, @$tree2 );
1026 0         0 return( $tree );
1027             }
1028             }
1029 435 100       5923 push( @$tree, 'und' ) unless( $tree->[-1] eq 'und' );
1030 435         7170 return( $tree );
1031             }
1032              
1033             sub metazone { return( shift->_fetch_one({
1034 1     1 1 5811 id => 'get_metazone',
1035             field => 'metazone',
1036             table => 'metazones',
1037             has_array => [qw( territories timezones )],
1038             }, @_ ) ); }
1039              
1040             sub metazones { return( shift->_fetch_all({
1041 1     1 1 6447 id => 'metazones',
1042             table => 'metazones',
1043             by => [],
1044             has_array => [qw( territories timezones )],
1045             }, @_ ) ); }
1046              
1047             sub metazone_names { return( shift->_fetch_one({
1048 1     1 1 5172 id => 'get_metazone_names',
1049             field => 'metazone',
1050             table => 'metazones_names',
1051             requires => [qw( locale width )],
1052             default => { start => undef },
1053             }, @_ ) ); }
1054              
1055             sub metazones_names { return( shift->_fetch_all({
1056 1     1 1 8997 id => 'metazones_names',
1057             table => 'metazones_names',
1058             by => [qw( locale metazone width )],
1059             }, @_ ) ); }
1060              
1061             # <https://unicode.org/reports/tr35/tr35.html#5.-canonicalizing-syntax>
1062             # <https://unicode.org/reports/tr35/tr35.html#4.-replacement>
1063             sub normalise
1064             {
1065 12     12 1 123855 my $self = shift( @_ );
1066 12         49 my $orig = shift( @_ );
1067 12         33 my $ref;
1068 12 100 66     112 unless( Scalar::Util::blessed( $orig ) &&
1069             $orig->isa( 'Locale::Unicode' ) )
1070             {
1071 11         29 my $backup = $orig;
1072 11         113 $orig = Locale::Unicode->new( "$orig" );
1073 11 50       8550 if( !defined( $orig ) )
1074             {
1075 0 0 0     0 if( ( $ref = $self->alias( alias => $backup, type => 'language' ) ) &&
      0        
      0        
1076             ref( $ref->{replacement} // '' ) eq 'ARRAY' &&
1077 0         0 scalar( @{$ref->{replacement}} ) )
1078             {
1079 0   0     0 my $locale = Locale::Unicode->new( $ref->{replacement}->[0] ) ||
1080             return( $self->pass_error( Locale::Unicode->error ) );
1081 0         0 return( $locale );
1082             }
1083             else
1084             {
1085 0         0 return( $self->pass_error( Locale::Unicode->error ) );
1086             }
1087             }
1088             }
1089             # canonical will create a clone
1090             # my $locale = $orig->canonical;
1091 12         33 my $locale = $orig;
1092              
1093             # <https://unicode.org/reports/tr35/tr35.html#BCP_47_Language_Tag_Conversion>
1094             # <https://unicode.org/reports/tr35/tr35.html#2.-alias-elements>
1095             # <https://unicode.org/reports/tr35/tr35.html#Unicode_Locale_Identifier_BCP_47_to_CLDR>
1096 12 100 50     64 if( my $privateuse = $locale->privateuse )
    100 66        
    50 100        
    100 50        
    100 66        
      100        
1097             {
1098 1         130 $locale->private( $privateuse );
1099 1         105 $locale->language3( 'und' );
1100             }
1101             elsif( my $grandfathered = $locale->grandfathered )
1102             {
1103 1 50 50     300 if( ( $ref = $self->alias( alias => $grandfathered, type => 'language' ) ) &&
      33        
      50        
1104             ref( $ref->{replacement} // '' ) eq 'ARRAY' &&
1105 1         11 scalar( @{$ref->{replacement}} ) )
1106             {
1107 1         8 my $tmp = Locale::Unicode->new( $ref->{replacement}->[0] );
1108 1         722 $tmp = $tmp->canonical;
1109             # Ensure the aias value we received is, itself, normalised.
1110 1   50     20135 $tmp = $self->normalise( $tmp ) || return( $self->pass_error );
1111 1         22 $locale->merge( $tmp );
1112             # Do not overwrite it
1113 1 50       1011 $locale->private( $grandfathered ) unless( $locale->private );
1114             }
1115             }
1116             elsif( !$locale->language_id )
1117             {
1118 0         0 $locale->language3( 'und' );
1119             }
1120             elsif( ( $ref = $self->alias( alias => "$locale", type => 'language' ) ) &&
1121             ref( $ref->{replacement} // '' ) eq 'ARRAY' &&
1122 1         6 scalar( @{$ref->{replacement}} ) )
1123             {
1124 1         4 my $repl = $ref->{replacement}->[0];
1125 1   50     6 while( $ref = $self->alias( alias => $repl, type => 'language' ) &&
1126             ref( $ref->{replacement} // '' ) eq 'ARRAY' &&
1127             scalar( @{$ref->{replacement}} ) )
1128             {
1129 0         0 $repl = $ref->{replacement}->[0];
1130             }
1131              
1132 1         12 my $tmp = Locale::Unicode->new( $repl );
1133 1         763 $locale->base( $tmp->base );
1134             }
1135             elsif( ( $ref = $self->alias( alias => $locale->language_extended, type => 'language' ) ) &&
1136             ref( $ref->{replacement} // '' ) eq 'ARRAY' &&
1137 4         21 scalar( @{$ref->{replacement}} ) )
1138             {
1139 4         16 my $repl = $ref->{replacement}->[0];
1140 4   50     23 while( $ref = $self->alias( alias => $repl, type => 'language' ) &&
1141             ref( $ref->{replacement} // '' ) eq 'ARRAY' &&
1142             scalar( @{$ref->{replacement}} ) )
1143             {
1144 0         0 $repl = $ref->{replacement}->[0];
1145             }
1146 4         45 my $tmp = Locale::Unicode->new( $repl );
1147 4         2560 $locale->language_id( undef );
1148 4         2220 $locale->extended( undef );
1149 4         463 $locale->merge( $tmp );
1150             }
1151              
1152             # As per the LDML specifications:
1153             # "If the field = territory, and the replacement.field has more than one value, then look up the most likely territory for the base language code (and script, if there is one). If that likely territory is in the list of replacements, use it. Otherwise, use the first territory in the list."
1154             # <https://unicode.org/reports/tr35/tr35.html#territory-exception>
1155 12 50 100     7771 if( $locale->territory &&
      50        
      66        
      100        
1156             ( $ref = $self->alias( alias => $locale->territory, type => 'territory' ) ) &&
1157             ref( $ref->{replacement} // '' ) eq 'ARRAY' &&
1158 3         22 scalar( @{$ref->{replacement}} ) )
1159             {
1160 3 100       8 if( scalar( @{$ref->{replacement}} ) > 1 )
  3         15  
1161             {
1162 2   50     16 my $tree = $self->make_inheritance_tree( $locale ) ||
1163             return( $self->pass_error );
1164 2         10 my $likely;
1165 2         9 foreach my $loc ( @$tree )
1166             {
1167 4         17 $likely = $self->likely_subtag( locale => $loc );
1168 4 50 66     37 last if( $likely && $likely->{target} );
1169             }
1170              
1171 2 50       9 if( defined( $likely ) )
1172             {
1173 2   50     18 my $tmp = Locale::Unicode->new( $likely->{target} ) ||
1174             return( $self->pass_error( Locale::Unicode->error ) );
1175 2         1878 my $cc = $tmp->territory;
1176 2 50       264 if( !$cc )
1177             {
1178 0         0 die( "It seems the Locale::Unicode::Data is corrupted as I could get a likely subtag for ${locale}, but the target '${tmp}' does not seem to contain a territory, which is impossible." );
1179             }
1180 2 50       6 if( scalar( grep( /^${cc}$/i, @{$ref->{replacement}} ) ) )
  2         111  
1181             {
1182 2         13 $locale->territory( $cc );
1183             }
1184             else
1185             {
1186 0         0 $locale->territory( $ref->{replacement}->[0] );
1187             }
1188             }
1189             else
1190             {
1191 0         0 $locale->territory( $ref->{replacement}->[0] );
1192             }
1193             }
1194             else
1195             {
1196 1         8 $locale->territory( $ref->{replacement}->[0] );
1197             }
1198             }
1199            
1200 12 100       13815 if( $locale->variant )
1201             {
1202 1         118 my $variants = [map{ lc( $_ ) } @{$locale->variants}];
  3         121  
  1         10  
1203 1         3 my $permute;
1204             $permute = sub
1205             {
1206 14     14   25 my( $list, $n ) = @_;
1207 14 100       85 return( map( [$_], @$list ) ) if( $n <= 1 );
1208 5         12 my @comb;
1209 5         17 for my $i ( 0 .. $#$list )
1210             {
1211 12         33 my @rest = @$list;
1212 12         21 my $val = splice( @rest, $i, 1 );
1213 12         36 push( @comb, [$val, @$_] ) for( $permute->( \@rest, $n - 1 ) );
1214             }
1215 5         39 return( @comb );
1216 1         14 };
1217              
1218 1         3 my $seen = {};
1219 1         3 my $found = 0;
1220 1         3 local $" = '-';
1221 1         7 my $len = scalar( @$variants );
1222 1         5 VARIANTS: while( $len > 0 )
1223             {
1224 2 50       15 $seen->{ $variants->[0] }++ if( scalar( @$variants ) );
1225 2         10 my @variations = $permute->( $variants, $len );
1226 2         8 foreach my $combo ( @variations )
1227             {
1228 10 50 66     72 if( ( $ref = $self->alias( alias => "und-@$combo", type => 'language' ) ) &&
      100        
1229             ref( $ref->{replacement} ) eq 'ARRAY' &&
1230 1         181 scalar( @{$ref->{replacement}} ) )
1231             {
1232 1         7 MATCH: for( my $i = 0; $i < scalar( @$combo ); $i++ )
1233             {
1234 2         8 for( my $j = 0; $j < scalar( @$variants ); $j++ )
1235             {
1236 4 100       13 if( $combo->[$i] eq $variants->[$j] )
1237             {
1238 2         5 splice( @$variants, $j, 1 );
1239 2         13 next MATCH;
1240             }
1241             }
1242             }
1243             # Set the new updated variants
1244 1 50       5 if( scalar( @$variants ) )
1245             {
1246 1         12 $locale->variant( "@$variants" );
1247             }
1248             else
1249             {
1250 0         0 $locale->variant( undef );
1251             }
1252 1         224 my $tmp = Locale::Unicode->new( $ref->{replacement}->[0] );
1253             # language ID 'und' is just a dummy one used. However, if it is anything else, we need to keep it.
1254 1 50       757 $tmp->language_id( undef ) if( $tmp->language_id eq 'und' );
1255 1         828 $locale->merge( $tmp );
1256 1         838 $locale->variant( join( '-', sort( @{$locale->variants} ) ) );
  1         5  
1257 1         227 $found++;
1258 1         22 last VARIANTS;
1259             }
1260             }
1261             # pop( @$variants );
1262 1         13 $len--;
1263             }
1264 1 50       15 unless( $found )
1265             {
1266 0         0 foreach my $variant ( @{$locale->variants} )
  0         0  
1267             {
1268 0 0       0 next if( exists( $seen->{ $variant } ) );
1269 0 0 0     0 if( ( $ref = $self->alias( alias => 'und-' . $variant, type => 'language' ) ) &&
      0        
1270             ref( $ref->{replacement} ) eq 'ARRAY' &&
1271 0         0 scalar( @{$ref->{replacement}} ) )
1272             {
1273 0         0 my $tmp = Locale::Unicode->new( $ref->{replacement}->[0] );
1274 0         0 $tmp->language_id( undef );
1275 0         0 $locale->merge( $tmp );
1276 0         0 $found++;
1277 0         0 last;
1278             }
1279             }
1280             }
1281 1 50       8 unless( $found )
1282             {
1283 0         0 foreach my $variant ( @{$locale->variants} )
  0         0  
1284             {
1285 0 0 0     0 if( ( $ref = $self->alias( alias => $variant, type => 'variant' ) ) &&
      0        
1286             ref( $ref->{replacement} ) eq 'ARRAY' &&
1287 0         0 scalar( @{$ref->{replacement}} ) )
1288             {
1289 0         0 $locale->variant( $ref->{replacement}->[0] );
1290 0         0 $found++;
1291 0         0 last;
1292             }
1293             }
1294             }
1295             }
1296              
1297 12         1151 my $script;
1298 12 0 66     59 if( ( $script = $locale->script ) &&
      33        
      50        
1299             ( $ref = $self->alias( alias => $script, type => 'script' ) ) &&
1300             ref( $ref->{replacement} ) eq 'ARRAY' &&
1301 0         0 scalar( @{$ref->{replacement}} ) )
1302             {
1303 0         0 $locale->script( $ref->{replacement}->[0] );
1304             }
1305              
1306 12         1007 return( $locale );
1307             }
1308              
1309             {
1310 5     5   52 no warnings 'once';
  5         10  
  5         2873  
1311             *normalize = \&normalise;
1312             }
1313              
1314             sub number_format_l10n { return( shift->_fetch_one({
1315 1     1 1 93248 id => 'get_number_format_l10n',
1316             field => 'format_id',
1317             table => 'number_formats_l10n',
1318             requires => [qw( locale number_system number_type format_length format_type alt count )],
1319             default => { alt => undef, count => undef },
1320             }, @_ ) ); }
1321              
1322             sub number_formats_l10n { return( shift->_fetch_all({
1323 3     3 1 89552 id => 'number_formats_l10n',
1324             table => 'number_formats_l10n',
1325             by => [qw( locale number_system number_type format_length format_type alt count )],
1326             }, @_ ) ); }
1327              
1328             sub number_symbol_l10n { return( shift->_fetch_one({
1329 1     1 1 7750 id => 'getnumber_symbol_l10n',
1330             field => 'property',
1331             table => 'number_symbols_l10n',
1332             requires => [qw( locale number_system alt )],
1333             default => { alt => undef },
1334             }, @_ ) ); }
1335              
1336             sub number_symbols_l10n { return( shift->_fetch_all({
1337 3     3 1 19043 id => 'number_symbols_l10n',
1338             table => 'number_symbols_l10n',
1339             by => [qw( locale number_system alt )],
1340             }, @_ ) ); }
1341              
1342             sub number_system { return( shift->_fetch_one({
1343 1     1 1 10233 id => 'get_number_system',
1344             field => 'number_system',
1345             table => 'number_systems',
1346             has_array => [qw( digits )],
1347             }, @_ ) ); }
1348              
1349             sub number_systems { return( shift->_fetch_all({
1350 1     1 1 11829 id => 'number_systems',
1351             table => 'number_systems',
1352             has_array => [qw( digits )],
1353             }, @_ ) ); }
1354              
1355             sub number_system_l10n { return( shift->_fetch_one({
1356 1     1 1 7662 id => 'getnumber_system_l10n',
1357             field => 'number_system',
1358             table => 'number_systems_l10n',
1359             requires => [qw( locale alt )],
1360             default => { alt => undef },
1361             }, @_ ) ); }
1362              
1363             sub number_systems_l10n { return( shift->_fetch_all({
1364 1     1 1 7678 id => 'number_systems_l10n',
1365             table => 'number_systems_l10n',
1366             by => [qw( locale number_system alt )],
1367             }, @_ ) ); }
1368              
1369             sub pass_error
1370             {
1371 0     0 0 0 my $self = shift( @_ );
1372 0   0     0 my $pack = ref( $self ) || $self;
1373 0         0 my $opts = {};
1374 0         0 my( $err, $class, $code );
1375 5     5   42 no strict 'refs';
  5         9  
  5         112765  
1376 0 0       0 if( scalar( @_ ) )
1377             {
1378             # Either an hash defining a new error and this will be passed along to error(); or
1379             # an hash with a single property: { class => 'Some::ExceptionClass' }
1380 0 0 0     0 if( scalar( @_ ) == 1 && ref( $_[0] ) eq 'HASH' )
1381             {
1382 0         0 $opts = $_[0];
1383             }
1384             else
1385             {
1386 0 0 0     0 if( scalar( @_ ) > 1 && ref( $_[-1] ) eq 'HASH' )
1387             {
1388 0         0 $opts = pop( @_ );
1389             }
1390 0         0 $err = $_[0];
1391             }
1392             }
1393 0 0 0     0 $err = $opts->{error} if( !defined( $err ) && CORE::exists( $opts->{error} ) && defined( $opts->{error} ) && CORE::length( $opts->{error} ) );
      0        
      0        
1394             # We set $class only if the hash provided is a one-element hash and not an error-defining hash
1395 0 0 0     0 $class = $opts->{class} if( CORE::exists( $opts->{class} ) && defined( $opts->{class} ) && CORE::length( $opts->{class} ) );
      0        
1396 0 0 0     0 $code = $opts->{code} if( CORE::exists( $opts->{code} ) && defined( $opts->{code} ) && CORE::length( $opts->{code} ) );
      0        
1397            
1398             # called with no argument, most likely from the same class to pass on an error
1399             # set up earlier by another method; or
1400             # with an hash containing just one argument class => 'Some::ExceptionClass'
1401 0 0 0     0 if( !defined( $err ) && ( !scalar( @_ ) || defined( $class ) ) )
    0 0        
      0        
      0        
      0        
1402             {
1403             # $error is a previous erro robject
1404 0 0       0 my $error = ref( $self ) ? $self->{error} : length( ${ $pack . '::ERROR' } ) ? ${ $pack . '::ERROR' } : undef;
  0 0       0  
  0         0  
1405 0 0       0 if( !defined( $error ) )
1406             {
1407 0         0 warn( "No error object provided and no previous error set either! It seems the previous method call returned a simple undef" );
1408             }
1409             else
1410             {
1411 0 0       0 $err = ( defined( $class ) ? bless( $error => $class ) : $error );
1412 0 0       0 $err->code( $code ) if( defined( $code ) );
1413             }
1414             }
1415             elsif( defined( $err ) &&
1416             Scalar::Util::blessed( $err ) &&
1417             ( scalar( @_ ) == 1 ||
1418             ( scalar( @_ ) == 2 && defined( $class ) )
1419             ) )
1420             {
1421 0 0       0 $self->{error} = ${ $pack . '::ERROR' } = ( defined( $class ) ? bless( $err => $class ) : $err );
  0         0  
1422 0 0 0     0 $self->{error}->code( $code ) if( defined( $code ) && $self->{error}->can( 'code' ) );
1423            
1424 0 0 0     0 if( $self->{fatal} || ( defined( ${"${class}\::FATAL_EXCEPTIONS"} ) && ${"${class}\::FATAL_EXCEPTIONS"} ) )
  0   0     0  
  0         0  
1425             {
1426 0         0 die( $self->{error} );
1427             }
1428             }
1429             # If the error provided is not an object, we call error to create one
1430             else
1431             {
1432 0         0 return( $self->error( @_ ) );
1433             }
1434            
1435 0 0       0 if( want( 'OBJECT' ) )
1436             {
1437 0         0 rreturn( Locale::Unicode::Data::NullObject->new );
1438             }
1439 0         0 return;
1440             }
1441              
1442             sub person_name_default { return( shift->_fetch_one({
1443 1     1 1 30392 id => 'get_person_name_default',
1444             field => 'locale',
1445             table => 'person_name_defaults',
1446             }, @_ ) ); }
1447              
1448             sub person_name_defaults { return( shift->_fetch_all({
1449 1     1 1 6151 id => 'person_name_defaults',
1450             table => 'person_name_defaults',
1451             }, @_ ) ); }
1452              
1453             # NOTE: plural rules for 222 locales based on the Unicode CDR rules set out in supplemental/plurals.xml
1454             # This is for the method plural_count()
1455             my $plural_rules =
1456             {
1457             # 1: other
1458             # bm bo dz hnj id ig ii in ja jbo jv jw kde kea km ko lkt lo ms my nqo osa root sah ses sg su th to tpi vi wo yo yue zh
1459             bm => { other => sub { 1 } },
1460             # The other locales in this group are aliased
1461              
1462             # 2: one, other
1463             # am as bn doi fa gu hi kn pcm zu
1464             am =>
1465             {
1466             one => sub { $_[0] == 0 || $_[0] == 1 },
1467             other => sub { 1 },
1468             },
1469             # The other locales in this group are aliased
1470              
1471             # ff hy kab
1472             ff =>
1473             {
1474             one => sub { $_[0] == 0 || $_[0] == 1 },
1475             other => sub { 1 },
1476             },
1477             # The other locales in this group are aliased
1478              
1479             # ast de en et fi fy gl ia io ji lij nl sc sv sw ur yi
1480             ast =>
1481             {
1482             one => sub { $_[0] == 1 && int( $_[0] ) == $_[0] },
1483             other => sub { 1 },
1484             },
1485             # The other locales in this group are aliased
1486              
1487             # si (Sinhala):
1488             si =>
1489             {
1490             one => sub
1491             {
1492             $_[0] == 0 ||
1493             $_[0] == 1 ||
1494             # For decimals where the integer part is 0
1495             ( int( $_[0] ) == 0 && $_[0] != 0 )
1496             },
1497             other => sub { 1 },
1498             },
1499             # ak bho csw guw ln mg nso pa ti wa
1500             ak =>
1501             {
1502             one => sub { $_[0] == 0 || $_[0] == 1 },
1503             other => sub { 1 },
1504             },
1505             # The other locales in this group are aliased
1506              
1507             # tzm
1508             tzm =>
1509             {
1510             one => sub
1511             {
1512             $_[0] == 0 ||
1513             $_[0] == 1 ||
1514             (
1515             $_[0] >= 11 &&
1516             $_[0] <= 99 &&
1517             int( $_[0] ) == $_[0]
1518             )
1519             },
1520             other => sub { 1 },
1521             },
1522             # af an asa az bal bem bez bg brx ce cgg chr ckb dv ee el eo eu fo fur gsw ha haw hu jgo jmc ka kaj kcg kk kkj kl ks ksb ku ky lb lg mas mgo ml mn mr nah nb nd ne nn nnh no nr ny nyn om or os pap ps rm rof rwk saq sd sdh seh sn so sq ss ssy st syr ta te teo tig tk tn tr ts ug uz ve vo vun wae xh xog
1523             af =>
1524             {
1525             one => sub { $_[0] == 1 && int( $_[0] ) == $_[0] },
1526             other => sub { 1 },
1527             },
1528             # The other locales in this group are aliased
1529              
1530             # da
1531             da =>
1532             {
1533             one => sub
1534             {
1535             $_[0] == 1 ||
1536             (
1537             int( $_[0] ) != $_[0] &&
1538             int( $_[0] ) == 0
1539             )
1540             },
1541             other => sub { 1 },
1542             },
1543             # is: Icelandic
1544             is =>
1545             {
1546             one => sub
1547             {
1548             int( $_[0] ) == $_[0] &&
1549             (
1550             (
1551             $_[0] % 10 == 1 &&
1552             $_[0] % 100 != 11
1553             )
1554             ||
1555             (
1556             int( $_[0] * 10 ) % 10 == 1 &&
1557             int( $_[0] * 100 ) % 100 != 11
1558             )
1559             )
1560             ||
1561             # Handling decimals
1562             (
1563             int( $_[0] ) != $_[0] &&
1564             $_[0] < 1.1
1565             )
1566             },
1567             other => sub { 1 },
1568             },
1569             # mk: Macedonian
1570             mk =>
1571             {
1572             one => sub
1573             {
1574             int( $_[0] ) == $_[0] &&
1575             (
1576             (
1577             $_[0] % 10 == 1 &&
1578             $_[0] % 100 != 11
1579             )
1580             ||
1581             (
1582             int( $_[0] * 10 ) % 10 == 1 &&
1583             int( $_[0] * 100 ) % 100 != 11
1584             )
1585             )
1586             ||
1587             # Handling decimals
1588             (
1589             int( $_[0] ) != $_[0] &&
1590             $_[0] < 1.1
1591             )
1592             },
1593             other => sub { 1 },
1594             },
1595             # ceb fil tl
1596             ceb =>
1597             {
1598             one => sub
1599             {
1600             int( $_[0] ) == $_[0] &&
1601             (
1602             (
1603             $_[0] == 1 ||
1604             $_[0] == 2 ||
1605             $_[0] == 3
1606             )
1607             ||
1608             (
1609             $_[0] % 10 != 4 &&
1610             $_[0] % 10 != 6 &&
1611             $_[0] % 10 != 9
1612             )
1613             )
1614             ||
1615             (
1616             int( $_[0] ) != $_[0] &&
1617             int( $_[0] * 10 ) % 10 != 4 &&
1618             int( $_[0] * 10 ) % 10 != 6 &&
1619             int( $_[0] * 10 ) % 10 != 9
1620             )
1621             },
1622             other => sub { 1 },
1623             },
1624             # The other locales in this group are aliased
1625              
1626             # 3: zero, one, other
1627             # lv (Latvian) prg
1628             lv =>
1629             {
1630             zero => sub
1631             {
1632             # Check for very small numbers, including 0 and close to zero
1633             # Slightly larger threshold to catch 0.01 and 0.001
1634             abs( $_[0] ) < 0.011
1635             ||
1636             # Include integers
1637             (
1638             int( $_[0] ) == $_[0] &&
1639             (
1640             $_[0] % 10 == 0 ||
1641             (
1642             $_[0] % 100 >= 11 &&
1643             $_[0] % 100 <= 19
1644             )
1645             )
1646             )
1647             },
1648             one => sub
1649             {
1650             (
1651             $_[0] % 10 == 1 &&
1652             $_[0] % 100 != 11
1653             )
1654             ||
1655             # Handle decimals for 'one', excluding numbers very close to zero
1656             (
1657             int( $_[0] ) != $_[0] &&
1658             # Exclude 0.01 explicitly
1659             $_[0] > 0.01 &&
1660             $_[0] < 1.1
1661             )
1662             },
1663             other => sub { 1 },
1664             },
1665             # The other locales in this group are aliased
1666              
1667             # lag
1668             lag =>
1669             {
1670             zero => sub { $_[0] == 0 },
1671             one => sub
1672             {
1673             $_[0] == 1 ||
1674             (
1675             int( $_[0] ) == 0 &&
1676             int( $_[0] ) != $_[0]
1677             )
1678             },
1679             other => sub { 1 },
1680             },
1681             # blo
1682             blo =>
1683             {
1684             zero => sub { $_[0] == 0 },
1685             one => sub { $_[0] == 1 },
1686             other => sub { 1 },
1687             },
1688             # ksh
1689             ksh =>
1690             {
1691             zero => sub { $_[0] == 0 },
1692             one => sub { $_[0] == 1 },
1693             other => sub { 1 },
1694             },
1695              
1696             # 3: one, two, other
1697             # he iw
1698             he =>
1699             {
1700             one => sub
1701             {
1702             (
1703             $_[0] == 1 &&
1704             int( $_[0] ) == $_[0]
1705             )
1706             ||
1707             (
1708             int( $_[0] ) != $_[0] &&
1709             $_[0] > 0 &&
1710             # Include all non-integers between 0 and 2 for 'one'
1711             $_[0] < 2
1712             )
1713             },
1714             two => sub { $_[0] == 2 && int( $_[0] ) == $_[0] },
1715             other => sub { 1 },
1716             },
1717             # The other locales in this group are aliased
1718              
1719             # iu naq sat se sma smi smj smn sms
1720             iu =>
1721             {
1722             one => sub { $_[0] == 1 && int( $_[0] ) == $_[0] },
1723             two => sub { $_[0] == 2 && int( $_[0] ) == $_[0] },
1724             other => sub { 1 },
1725             },
1726             # The other locales in this group are aliased
1727              
1728             # 3: one, few, other
1729             # shi
1730             shi =>
1731             {
1732             one => sub { $_[0] == 0 || $_[0] == 1 },
1733             few => sub
1734             {
1735             $_[0] >= 2 &&
1736             $_[0] <= 10 &&
1737             int( $_[0] ) == $_[0]
1738             },
1739             other => sub { 1 },
1740             },
1741             # mo ro
1742             mo =>
1743             {
1744             one => sub { $_[0] == 1 && int( $_[0] ) == $_[0] },
1745             few => sub
1746             {
1747             int( $_[0] ) != $_[0] ||
1748             $_[0] == 0 ||
1749             (
1750             $_[0] % 100 >= 1 &&
1751             $_[0] % 100 <= 19 &&
1752             $_[0] != 1
1753             )
1754             },
1755             other => sub { 1 },
1756             },
1757             # The other locales in this group are aliased
1758              
1759             # bs (Bosnian) hr sh sr
1760             bs =>
1761             {
1762             one => sub
1763             {
1764             (
1765             int( $_[0] ) == $_[0] &&
1766             (
1767             (
1768             $_[0] % 10 == 1 &&
1769             $_[0] % 100 != 11
1770             )
1771             ||
1772             (
1773             int( $_[0] * 10 ) % 10 == 1 &&
1774             int( $_[0] * 100 ) % 100 != 11
1775             )
1776             )
1777             )
1778             ||
1779             # Handle decimals for 'one'
1780             (
1781             int( $_[0] ) != $_[0] &&
1782             $_[0] < 1.1 &&
1783             $_[0] > 0 &&
1784             # Exclude numbers like 0.2 from being 'one'
1785             $_[0] < 0.2
1786             )
1787             },
1788             few => sub
1789             {
1790             (
1791             int( $_[0] ) == $_[0] &&
1792             (
1793             (
1794             $_[0] % 10 >= 2 &&
1795             $_[0] % 10 <= 4 &&
1796             $_[0] % 100 < 10
1797             )
1798             ||
1799             (
1800             $_[0] % 10 >= 2 &&
1801             $_[0] % 10 <= 4 &&
1802             $_[0] % 100 >= 20
1803             )
1804             ||
1805             (
1806             int( $_[0] * 10 ) % 10 >= 2 &&
1807             int( $_[0] * 10 ) % 10 <= 4 &&
1808             int( $_[0] * 100 ) % 100 < 10
1809             )
1810             ||
1811             (
1812             int( $_[0] * 10 ) % 10 >= 2 &&
1813             int( $_[0] * 10 ) % 10 <= 4 &&
1814             int( $_[0] * 100 ) % 100 >= 20
1815             )
1816             )
1817             )
1818             ||
1819             # Handle decimals for 'few' including numbers like 0.2 but not 1.1
1820             (
1821             int( $_[0] ) != $_[0] &&
1822             (
1823             $_[0] >= 0.2 &&
1824             $_[0] < 1.2 &&
1825             # Exclude 1.1 specifically
1826             $_[0] != 1.1
1827             )
1828             )
1829             },
1830             many => sub
1831             {
1832             int( $_[0] ) == $_[0] &&
1833             (
1834             (
1835             $_[0] % 10 == 0 ||
1836             (
1837             $_[0] % 10 >= 5 &&
1838             $_[0] % 10 <= 9
1839             )
1840             ||
1841             (
1842             $_[0] % 100 >= 11 &&
1843             $_[0] % 100 <= 14
1844             )
1845             )
1846             ||
1847             (
1848             int( $_[0] * 10 ) % 10 == 0 ||
1849             (
1850             int( $_[0] * 10 ) % 10 >= 5 &&
1851             int( $_[0] * 10 ) % 10 <= 9
1852             )
1853             ||
1854             (
1855             int( $_[0] * 100 ) % 100 >= 11 &&
1856             int( $_[0] * 100 ) % 100 <= 14
1857             )
1858             )
1859             )
1860             &&
1861             # Exclude specific cases that should be 'other'
1862             !( $_[0] == 11 || $_[0] == 5 )
1863             &&
1864             # Exclude decimals that should be 'few'
1865             !( $_[0] >= 1.1 && $_[0] < 1.5 )
1866             },
1867             other => sub { 1 },
1868             },
1869             # The other locales in this group are aliased
1870              
1871             # 3: one, many, other
1872             # fr
1873             fr =>
1874             {
1875             one => sub { $_[0] == 0 || $_[0] == 1 },
1876             many => sub
1877             {
1878             (
1879             int( $_[0] ) != $_[0] &&
1880             (
1881             # Check if there's a fractional part but exclude exact half-integers like 1.5
1882             int( $_[0] * 1000000 ) != int( $_[0] ) * 1000000 &&
1883             # Explicitly exclude numbers like 1.5 but allow numbers like 1000000.5
1884             !($_[0] - int( $_[0]) == 0.5 && int( $_[0] ) % 1000000 != 0)
1885             )
1886             )
1887             ||
1888             (
1889             int( $_[0] ) != 0 &&
1890             (
1891             $_[0] % 1000000 == 0 ||
1892             # Handle cases like 1000000.5 where the integer part is divisible by 1,000,000
1893             (int( $_[0] ) % 1000000 == 0 && $_[0] != int( $_[0] ))
1894             ) &&
1895             int( $_[0] ) == $_[0] &&
1896             $_[0] > 1
1897             )
1898             },
1899             other => sub { 1 },
1900             },
1901             # pt
1902             pt =>
1903             {
1904             one => sub { $_[0] == 0 || $_[0] == 1 },
1905             many => sub
1906             {
1907             int( $_[0] ) != $_[0] ||
1908             (
1909             int( $_[0] ) != 0 &&
1910             $_[0] % 1000000 == 0 &&
1911             int( $_[0] ) == $_[0]
1912             )
1913             },
1914             other => sub { 1 },
1915             },
1916             # ca it lld pt_PT scn vec
1917             ca =>
1918             {
1919             one => sub { $_[0] == 1 && int( $_[0] ) == $_[0] },
1920             many => sub
1921             {
1922             int( $_[0] ) != $_[0] ||
1923             (
1924             int( $_[0] ) != 0 &&
1925             $_[0] % 1000000 == 0 &&
1926             int( $_[0] ) == $_[0]
1927             )
1928             },
1929             other => sub { 1 },
1930             },
1931             # The other locales in this group are aliased
1932              
1933             # es
1934             es =>
1935             {
1936             one => sub { $_[0] == 1 && int( $_[0] ) == $_[0] },
1937             many => sub
1938             {
1939             int( $_[0]) != $_[0] ||
1940             (
1941             int( $_[0] ) != 0 &&
1942             $_[0] % 1000000 == 0 &&
1943             int( $_[0] ) == $_[0]
1944             )
1945             },
1946             other => sub { 1 },
1947             },
1948              
1949             # 4: one, two, few, other
1950             # gd
1951             gd =>
1952             {
1953             one => sub { $_[0] == 1 || $_[0] == 11 },
1954             two => sub { $_[0] == 2 || $_[0] == 12 },
1955             few => sub
1956             {
1957             $_[0] >= 3 &&
1958             (
1959             $_[0] <= 10 ||
1960             $_[0] >= 13
1961             )
1962             && $_[0] <= 19
1963             },
1964             other => sub { 1 },
1965             },
1966             # sl
1967             sl =>
1968             {
1969             one => sub { int( $_[0]) == $_[0] && $_[0] % 100 == 1 },
1970             two => sub { int( $_[0]) == $_[0] && $_[0] % 100 == 2 },
1971             few => sub
1972             {
1973             int( $_[0] ) == $_[0] &&
1974             (
1975             $_[0] % 100 == 3 ||
1976             $_[0] % 100 == 4
1977             )
1978             ||
1979             int( $_[0] ) != $_[0]
1980             },
1981             other => sub { 1 },
1982             },
1983             # dsb (Lower Sorbian) hsb
1984             dsb =>
1985             {
1986             one => sub
1987             {
1988             (
1989             int( $_[0] ) == $_[0] &&
1990             (
1991             ( $_[0] % 100 == 1 )
1992             ||
1993             ( int( $_[0] * 10 ) % 100 == 1 )
1994             )
1995             )
1996             ||
1997             # Handle decimals for 'one'
1998             (
1999             int( $_[0] ) != $_[0] &&
2000             $_[0] > 0 &&
2001             $_[0] < 1.1
2002             )
2003             },
2004             two => sub
2005             {
2006             int( $_[0] ) == $_[0] &&
2007             (
2008             ( $_[0] % 100 == 2 )
2009             ||
2010             ( int( $_[0] * 10 ) % 100 == 2 )
2011             )
2012             },
2013             few => sub
2014             {
2015             int( $_[0] ) == $_[0] &&
2016             (
2017             ( $_[0] % 100 >= 3 && $_[0] % 100 <= 4 )
2018             ||
2019             (
2020             int( $_[0] * 10 ) % 100 >= 3 &&
2021             int( $_[0] * 10 ) % 100 <= 4
2022             )
2023             )
2024             },
2025             other => sub { 1 },
2026             },
2027             # The other locales in this group are aliased
2028              
2029             # 4: one, few, many, other
2030             # cs sk
2031             cs =>
2032             {
2033             one => sub { $_[0] == 1 && int( $_[0] ) == $_[0] },
2034             few => sub
2035             {
2036             $_[0] >= 2 &&
2037             $_[0] <= 4 &&
2038             int( $_[0] ) == $_[0]
2039             },
2040             many => sub { int( $_[0] ) != $_[0] },
2041             other => sub { 1 },
2042             },
2043             # The other locales in this group are aliased
2044              
2045             # pl (Polish)
2046             pl =>
2047             {
2048             one => sub { $_[0] == 1 && int( $_[0] ) == $_[0] },
2049             few => sub
2050             {
2051             int( $_[0] ) == $_[0] &&
2052             $_[0] % 10 >= 2 &&
2053             $_[0] % 10 <= 4 &&
2054             (
2055             $_[0] % 100 < 10 ||
2056             $_[0] % 100 >= 20
2057             )
2058             },
2059             many => sub
2060             {
2061             int( $_[0] ) == $_[0] &&
2062             (
2063             $_[0] % 10 == 0 ||
2064             (
2065             $_[0] % 10 >= 5 &&
2066             $_[0] % 10 <= 9
2067             )
2068             ||
2069             (
2070             $_[0] % 100 >= 11 &&
2071             $_[0] % 100 <= 14
2072             )
2073             )
2074             ||
2075             int( $_[0] ) != $_[0]
2076             },
2077             other => sub { 1 },
2078             },
2079             # be (Belarusian)
2080             be =>
2081             {
2082             one => sub
2083             {
2084             int( $_[0] ) == $_[0] &&
2085             $_[0] % 10 == 1 &&
2086             $_[0] % 100 != 11
2087             },
2088             few => sub
2089             {
2090             int( $_[0] ) == $_[0] &&
2091             $_[0] % 10 >= 2 &&
2092             $_[0] % 10 <= 4 &&
2093             (
2094             $_[0] % 100 < 10 ||
2095             $_[0] % 100 >= 20
2096             )
2097             },
2098             many => sub
2099             {
2100             int( $_[0] ) == $_[0] &&
2101             (
2102             (
2103             $_[0] % 10 == 0 ||
2104             $_[0] % 10 >= 5
2105             )
2106             ||
2107             (
2108             $_[0] % 100 >= 11 &&
2109             $_[0] % 100 <= 14
2110             )
2111             )
2112             },
2113             other => sub { int( $_[0] ) != $_[0] },
2114             },
2115             # lt (Lithuanian)
2116             lt =>
2117             {
2118             one => sub
2119             {
2120             int( $_[0] ) == $_[0] &&
2121             $_[0] % 10 == 1 &&
2122             !(
2123             $_[0] % 100 >= 11 &&
2124             $_[0] % 100 <= 19
2125             )
2126             },
2127             few => sub
2128             {
2129             int( $_[0] ) == $_[0] &&
2130             $_[0] % 10 >= 2 &&
2131             $_[0] % 10 <= 9 &&
2132             (
2133             $_[0] % 100 < 10 ||
2134             $_[0] % 100 >= 20
2135             )
2136             },
2137             many => sub { int( $_[0] ) != $_[0] },
2138             other => sub
2139             {
2140             int( $_[0] ) == $_[0] &&
2141             (
2142             $_[0] % 100 >= 11 &&
2143             (
2144             $_[0] % 100 <= 19 ||
2145             $_[0] % 10 == 0
2146             )
2147             )
2148             },
2149             },
2150             # ru (Russian) uk (Ukrainian)
2151             ru =>
2152             {
2153             one => sub
2154             {
2155             int( $_[0] ) == $_[0] &&
2156             $_[0] % 10 == 1 &&
2157             $_[0] % 100 != 11
2158             },
2159             few => sub
2160             {
2161             int( $_[0] ) == $_[0] &&
2162             $_[0] % 10 >= 2 &&
2163             $_[0] % 10 <= 4 &&
2164             (
2165             $_[0] % 100 < 10 ||
2166             $_[0] % 100 >= 20
2167             )
2168             },
2169             many => sub
2170             {
2171             int( $_[0] ) == $_[0] &&
2172             (
2173             (
2174             $_[0] % 10 == 0 ||
2175             $_[0] % 10 >= 5
2176             )
2177             ||
2178             (
2179             $_[0] % 100 >= 11 &&
2180             $_[0] % 100 <= 14
2181             )
2182             )
2183             },
2184             other => sub { int( $_[0] ) != $_[0] },
2185             },
2186             # The other locales in this group are aliased
2187              
2188             # 5: one, two, few, many, other
2189             # br
2190             br =>
2191             {
2192             one => sub
2193             {
2194             int( $_[0] ) == $_[0] &&
2195             $_[0] % 10 == 1 &&
2196             $_[0] % 100 != 11 &&
2197             $_[0] % 100 != 71 &&
2198             $_[0] % 100 != 91
2199             },
2200             two => sub
2201             {
2202             int( $_[0] ) == $_[0] &&
2203             $_[0] % 10 == 2 &&
2204             $_[0] % 100 != 12 &&
2205             $_[0] % 100 != 72 &&
2206             $_[0] % 100 != 92
2207             },
2208             few => sub
2209             {
2210             int( $_[0] ) == $_[0] &&
2211             (
2212             (
2213             $_[0] % 10 >= 3 &&
2214             (
2215             $_[0] % 10 <= 4 ||
2216             $_[0] % 10 == 9
2217             )
2218             )
2219             &&
2220             (
2221             $_[0] % 100 < 10 ||
2222             $_[0] % 100 > 19
2223             )
2224             &&
2225             (
2226             $_[0] % 100 < 70 ||
2227             $_[0] % 100 > 79
2228             )
2229             &&
2230             (
2231             $_[0] % 100 < 90 ||
2232             $_[0] % 100 > 99
2233             )
2234             )
2235             },
2236             many => sub
2237             {
2238             int( $_[0] ) == $_[0] &&
2239             $_[0] != 0 &&
2240             $_[0] % 1000000 == 0
2241             },
2242             other => sub { 1 },
2243             },
2244             # mt
2245             mt =>
2246             {
2247             one => sub { $_[0] == 1 && int( $_[0] ) == $_[0] },
2248             two => sub { $_[0] == 2 && int( $_[0] ) == $_[0] },
2249             few => sub
2250             {
2251             $_[0] == 0 ||
2252             (
2253             int( $_[0] ) == $_[0] &&
2254             $_[0] % 100 >= 3 &&
2255             $_[0] % 100 <= 10
2256             )
2257             },
2258             many => sub
2259             {
2260             int( $_[0] ) == $_[0] &&
2261             $_[0] % 100 >= 11 &&
2262             $_[0] % 100 <= 19
2263             },
2264             other => sub { 1 },
2265             },
2266             # ga
2267             ga =>
2268             {
2269             one => sub { $_[0] == 1 && int( $_[0] ) == $_[0] },
2270             two => sub { $_[0] == 2 && int( $_[0] ) == $_[0] },
2271             few => sub
2272             {
2273             $_[0] >= 3 &&
2274             $_[0] <= 6 &&
2275             int( $_[0] ) == $_[0]
2276             },
2277             many => sub
2278             {
2279             $_[0] >= 7 &&
2280             $_[0] <= 10 &&
2281             int( $_[0] ) == $_[0]
2282             },
2283             other => sub { 1 },
2284             },
2285             # gv
2286             gv =>
2287             {
2288             one => sub { int( $_[0] ) == $_[0] && $_[0] % 10 == 1 },
2289             two => sub { int( $_[0] ) == $_[0] && $_[0] % 10 == 2 },
2290             few => sub
2291             {
2292             int( $_[0] ) == $_[0] &&
2293             (
2294             $_[0] % 100 == 0 ||
2295             $_[0] % 100 == 20 ||
2296             $_[0] % 100 == 40 ||
2297             $_[0] % 100 == 60 ||
2298             $_[0] % 100 == 80
2299             )
2300             },
2301             many => sub { int( $_[0] ) != $_[0] },
2302             other => sub { 1 },
2303             },
2304              
2305             # 6: zero, one, two, few, many, other
2306             # kw (Cornish)
2307             kw =>
2308             {
2309             zero => sub { $_[0] == 0 },
2310             one => sub { $_[0] == 1 },
2311             two => sub
2312             {
2313             int( $_[0] ) == $_[0] &&
2314             (
2315             # Directly include 2
2316             $_[0] == 2
2317             ||
2318             # Existing conditions for other cases
2319             (
2320             (
2321             $_[0] % 100 == 22 ||
2322             $_[0] % 100 == 42 ||
2323             $_[0] % 100 == 62 ||
2324             $_[0] % 100 == 82
2325             )
2326             ||
2327             (
2328             $_[0] % 1000 == 0 &&
2329             (
2330             $_[0] % 100000 >= 1000 &&
2331             $_[0] % 100000 <= 20000
2332             )
2333             )
2334             ||
2335             (
2336             $_[0] % 100000 == 40000 ||
2337             $_[0] % 100000 == 60000 ||
2338             $_[0] % 100000 == 80000
2339             )
2340             ||
2341             (
2342             $_[0] % 1000000 == 100000 &&
2343             $_[0] != 0
2344             )
2345             )
2346             )
2347             },
2348             few => sub
2349             {
2350             int( $_[0] ) == $_[0] &&
2351             (
2352             $_[0] % 100 == 3 ||
2353             $_[0] % 100 == 23 ||
2354             $_[0] % 100 == 43 ||
2355             $_[0] % 100 == 63 ||
2356             $_[0] % 100 == 83
2357             )
2358             },
2359             many => sub
2360             {
2361             int( $_[0] ) == $_[0] &&
2362             $_[0] != 1 &&
2363             (
2364             $_[0] % 100 == 1 ||
2365             $_[0] % 100 == 21 ||
2366             $_[0] % 100 == 41 ||
2367             $_[0] % 100 == 61 ||
2368             $_[0] % 100 == 81
2369             )
2370             },
2371             other => sub { 1 },
2372             },
2373             # ar ars
2374             ar =>
2375             {
2376             zero => sub { $_[0] == 0 },
2377             one => sub { $_[0] == 1 },
2378             two => sub { $_[0] == 2 },
2379             few => sub
2380             {
2381             int( $_[0] ) == $_[0] &&
2382             $_[0] % 100 >= 3 &&
2383             $_[0] % 100 <= 10
2384             },
2385             many => sub
2386             {
2387             int( $_[0] ) == $_[0] &&
2388             $_[0] % 100 >= 11 &&
2389             $_[0] % 100 <= 99
2390             },
2391             other => sub { 1 },
2392             },
2393             # The other locales in this group are aliased
2394              
2395             # cy
2396             cy =>
2397             {
2398             zero => sub { $_[0] == 0 },
2399             one => sub { $_[0] == 1 },
2400             two => sub { $_[0] == 2 },
2401             few => sub { $_[0] == 3 },
2402             many => sub { $_[0] == 6 },
2403             other => sub { 1 },
2404             },
2405             };
2406              
2407             # NOTE: Aliasing for plural forms
2408             my $aliases =
2409             {
2410             # 1: other
2411             bm => [qw( bo dz hnj id ig ii in ja jbo jv jw kde kea km ko lkt lo ms my nqo osa root sah ses sg su th to tpi vi wo yo yue zh )],
2412             # 2: one, other
2413             am => [qw( as bn doi fa gu hi kn pcm zu )],
2414             ff => [qw( hy kab )],
2415             ast => [qw( de en et fi fy gl ia io ji lij nl sc sv sw ur yi )],
2416             ak => [qw( bho csw guw ln mg nso pa ti wa )],
2417             af => [qw( an asa az bal bem bez bg brx ce cgg chr ckb dv ee el eo eu fo fur gsw ha haw hu jgo jmc ka kaj kcg kk kkj kl ks ksb ku ky lb lg mas mgo ml mn mr nah nb nd ne nn nnh no nr ny nyn om or os pap ps rm rof rwk saq sd sdh seh sn so sq ss ssy st syr
2418             ta te teo tig tk tn tr ts ug uz ve vo vun wae xh xog )],
2419             ceb => [qw( fil tl )],
2420              
2421             # 3: zero,one,other
2422             lv => [qw( prg )],
2423              
2424             # 3: one,two,other
2425             he => [qw( iw )],
2426             iu => [qw( naq sat se sma smi smj smn sms )],
2427              
2428             # 3: one,few,other
2429             mo => [qw( ro )],
2430             bs => [qw( hr sh sr )],
2431              
2432             # 3: one,many,other
2433             ca => [qw( it lld pt-PT scn vec )],
2434              
2435             # 4: one,two,few,other
2436             dsb => [qw( hsb )],
2437              
2438             # 4: one,few,many,other
2439             cs => [qw( sk )],
2440             ru => [qw( uk )],
2441              
2442             # 5: one,two,few,many,other
2443             # No aliases in this group
2444              
2445             # 6: zero,one,two,few,many,other
2446             ar => [qw( ars )],
2447             };
2448              
2449             foreach my $locale ( keys( %$aliases ) )
2450             {
2451             $plural_rules->{ $_ } = $plural_rules->{ $locale } for( @{$aliases->{ $locale }} );
2452             }
2453              
2454             # https://unicode.org/reports/tr35/tr35-numbers.html#Language_Plural_Rules
2455             # https://cldr.unicode.org/index/cldr-spec/plural-rules
2456             # https://unicode.org/reports/tr35/tr35-dates.html#Contents
2457             sub plural_count
2458             {
2459 246     246 1 248508 my $self = shift( @_ );
2460 246         541 my $number = shift( @_ );
2461 246         514 my $locale = shift( @_ );
2462 246 50 50     1892 if( !length( $number // '' ) )
    50          
2463             {
2464 0         0 return( $self->error( "No number was provided to get its plural count." ) );
2465             }
2466             elsif( !length( $locale ) )
2467             {
2468 0         0 return( $self->error( "No locale was provided to get its plural count." ) );
2469             }
2470 246   50     1066 $locale = $self->_locale_object( $locale ) ||
2471             return( $self->pass_error );
2472              
2473 246         1408 my $rules;
2474 246   50     867 my $tree = $self->make_inheritance_tree( $locale->base ) ||
2475             return( $self->pass_error );
2476 246         694 foreach my $loc ( @$tree )
2477             {
2478 246 50       934 if( exists( $plural_rules->{ $loc } ) )
2479             {
2480 246         415 $rules = $plural_rules->{ $loc };
2481 246         499 last;
2482             }
2483             }
2484             # I could also write it as $rules //= { one => sub { $_[0] == 1 }, other => sub { 1 } };
2485             # but I would lose point for readability
2486 246 50       564 if( !defined( $rules ) )
2487             {
2488 0     0   0 $rules = { one => sub { $_[0] == 1 }, other => sub { 1 } };
  0         0  
  0         0  
2489             }
2490 246         574 foreach my $category ( qw( zero one two few many other ) )
2491             {
2492 953 100 100     3286 if( exists( $rules->{ $category } ) &&
2493             $rules->{ $category }->( $number ) )
2494             {
2495 245         2529 return( $category );
2496             }
2497             }
2498             # It should never reach here
2499 1         7 return( 'other' );
2500             }
2501              
2502             # The hash reference containing the core 40 locales on which all the other 182, out of 222 locales, are aliases.
2503             my $plural_forms;
2504             sub plural_forms
2505             {
2506 222     222 1 250588 my $self = shift( @_ );
2507 222   50     912 my $locale = shift( @_ ) ||
2508             return( $self->error( "No locale has been provided to retrieve its Gettext plural forms." ) );
2509             # This is designed to minimise memory consumption.
2510             # Also, the list is pre-built in advance. Given it contains only 40 locales, it has a high effort-merit ratio and saves CPU.
2511             # So, no need to dynamically convert CLDR plural rules into its Gettext plural forms equivalent.
2512             # If our dictionary is not yet defined, we create it now.
2513 222 100       917 unless( defined( $plural_forms ) )
2514             {
2515 1         2 my $plural_forms_data = <<'EOT';
2516             $plural_forms =
2517             {
2518             af => "nplurals=2; plural=(n != 1);",
2519             ak => "nplurals=2; plural=(n > 1);",
2520             am => "nplurals=2; plural=(n > 1);",
2521             ar => "nplurals=6; plural=(n==0 ? 0 : n==1 ? 1 : n==2 ? 2 : n%100>=3 && n%100<=10 ? 3 : n%100>=11 ? 4 : 5);",
2522             ast => "nplurals=2; plural=(n != 1);",
2523             be => "nplurals=3; plural=(n%10==1 && n%100!=11 ? 0 : n%10>=2 && n%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2);",
2524             blo => "nplurals=3; plural=(n==0 ? 0 : n==1 ? 1 : 2);",
2525             bm => "nplurals=1; plural=0;",
2526             br => "nplurals=5; plural=(n%10==1 && !(n%100==11||n%100==71||n%100==91) ? 0 : n%10==2 && !(n%100==12||n%100==72||n%100==92) ? 1 : (n%10==3||n%10==4||n%10==9) && !(n%100>=10&&n%100<=19||n%100>=70&&n%100<=79||n%100>=90&&n%100<=99) ? 2 : n!=0&&n%1000000==0 ? 3 : 4);",
2527             bs => "nplurals=3; plural=(n%10==1 && n%100!=11 ? 0 : n%10>=2 && n%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2);",
2528             ca => "nplurals=2; plural=(n != 1);",
2529             ceb => "nplurals=2; plural=(n > 1);",
2530             cs => "nplurals=3; plural=(n==1 ? 0 : n>=2 && n<=4 ? 1 : 2);",
2531             cy => "nplurals=4; plural=(n==1 ? 0 : n==2 ? 1 : n!=8 && n!=11 ? 2 : 3);",
2532             da => "nplurals=2; plural=(n != 1);",
2533             dsb => "nplurals=4; plural=(n%100==1 ? 0 : n%100==2 ? 1 : n%100==3 || n%100==4 ? 2 : 3);",
2534             es => "nplurals=2; plural=(n != 1);",
2535             ff => "nplurals=2; plural=(n != 1);",
2536             fr => "nplurals=2; plural=(n > 1);",
2537             ga => "nplurals=5; plural=(n==1 ? 0 : n==2 ? 1 : n>2 && n<7 ? 2 : n>6 && n<11 ? 3 : 4);",
2538             gd => "nplurals=4; plural=(n==1 || n==11 ? 0 : n==2 || n==12 ? 1 : n>2 && n<20 ? 2 : 3);",
2539             gv => "nplurals=2; plural=(n > 1);",
2540             he => "nplurals=2; plural=(n != 1);",
2541             is => "nplurals=2; plural=(n%10!=1 || n%100==11);",
2542             iu => "nplurals=3; plural=(n==1 ? 0 : n==2 ? 1 : 2);",
2543             ksh => "nplurals=3; plural=(n==0 ? 0 : n==1 ? 1 : 2);",
2544             kw => "nplurals=4; plural=(n==1 ? 0 : n==2 ? 1 : n==3 ? 2 : 3);",
2545             lag => "nplurals=3; plural=(n==0 ? 0 : n==1 ? 1 : 2);",
2546             lt => "nplurals=3; plural=(n%10==1 && n%100!=11 ? 0 : n%10>=2 && (n%100<10 || n%100>=20) ? 1 : 2);",
2547             lv => "nplurals=3; plural=(n%10==1 && n%100!=11 ? 0 : n!=0 ? 1 : 2);",
2548             mk => "nplurals=2; plural=(n==1 || n%10==1 ? 0 : 1);",
2549             mo => "nplurals=3; plural=(n==1 ? 0 : n==0 || (n%100>0 && n%100<20) ? 1 : 2);",
2550             mt => "nplurals=4; plural=(n==1 ? 0 : n==0 || (n%100>1 && n%100<11) ? 1 : n%100>10 && n%100<20 ? 2 : 3);",
2551             pl => "nplurals=3; plural=(n==1 ? 0 : n%10>=2 && n%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2);",
2552             pt => "nplurals=2; plural=(n != 1);",
2553             ru => "nplurals=3; plural=(n%10==1 && n%100!=11 ? 0 : n%10>=2 && n%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2);",
2554             shi => "nplurals=3; plural=(n==0 || n==1 ? 0 : n>=2 && n<=10 ? 1 : 2);",
2555             si => "nplurals=2; plural=(n != 1);",
2556             sl => "nplurals=4; plural=(n%100==1 ? 0 : n%100==2 ? 1 : n%100==3 || n%100==4 ? 2 : 3);",
2557             tzm => "nplurals=2; plural=(n != 1);",
2558             };
2559             EOT
2560 1         2 local $@;
2561 1         204 eval( $plural_forms_data );
2562 1 50       6 if( $@ )
2563             {
2564 0         0 return( $self->error( "Error evaluating the list of 40 core Gettext plural rules: $@" ) );
2565             }
2566             }
2567              
2568 222 100       932 if( exists( $plural_forms->{ $locale } ) )
2569             {
2570 40         158 return( $plural_forms->{ $locale } );
2571             }
2572             else
2573             {
2574 182   50     1243 $locale = $self->_locale_object( $locale ) ||
2575             return( $self->pass_error );
2576            
2577 182   50     1484 my $tree = $self->make_inheritance_tree( $locale->base ) ||
2578             return( $self->pass_error );
2579 182         674 foreach my $loc ( @$tree )
2580             {
2581 182 50       851 if( exists( $plural_forms->{ $loc } ) )
2582             {
2583 0         0 return( $plural_forms->{ $loc } );
2584             }
2585             # It is actually the 'aliases' property we are after, so we know which one of the core 40 we should be using.
2586 182   50     918 my $all = $self->plural_rules( locale => $loc ) ||
2587             return( $self->pass_error );
2588 182 50 50     1192 if( $all && scalar( @$all ) )
2589             {
2590 182 50 33     1010 if( $all->[0]->{aliases} && ref( $all->[0]->{aliases} ) eq 'ARRAY' )
2591             {
2592 182         458 foreach my $l ( @{$all->[0]->{aliases}} )
  182         671  
2593             {
2594 182 50       733 if( exists( $plural_forms->{ $l } ) )
2595             {
2596 182         4328 return( $plural_forms->{ $l } );
2597             }
2598             }
2599             }
2600             }
2601             }
2602             # Nothing found.
2603 0         0 return( '' );
2604             }
2605             }
2606              
2607             sub plural_range { return( shift->_fetch_one({
2608 0     0 1 0 id => 'get_plural_range',
2609             field => 'result',
2610             has_array => [qw( aliases )],
2611             table => 'plural_ranges',
2612             requires => [qw( locale start stop )],
2613             default => { alt => undef },
2614             }, @_ ) ); }
2615              
2616             sub plural_ranges { return( shift->_fetch_all({
2617 0     0 1 0 id => 'plural_ranges',
2618             has_array => [qw( aliases )],
2619             table => 'plural_ranges',
2620             by => [qw( locale aliases start stop result )],
2621             }, @_ ) ); }
2622              
2623             sub plural_rule { return( shift->_fetch_one({
2624 0     0 1 0 id => 'get_plural_rule',
2625             field => 'rule',
2626             has_array => [qw( aliases )],
2627             table => 'plural_rules',
2628             requires => [qw( locale count )],
2629             }, @_ ) ); }
2630              
2631             sub plural_rules { return( shift->_fetch_all({
2632 182     182 1 1738 id => 'plural_rules',
2633             has_array => [qw( aliases )],
2634             table => 'plural_rules',
2635             by => [qw( locale aliases count rule )],
2636             }, @_ ) ); }
2637              
2638             sub rbnf { return( shift->_fetch_one({
2639 1     1 1 7200 id => 'get_rbnf',
2640             field => 'rule_id',
2641             table => 'rbnf',
2642             requires => [qw( locale ruleset )],
2643             }, @_ ) ); }
2644              
2645             sub rbnfs { return( shift->_fetch_all({
2646 4     4 1 80247 id => 'rbnf',
2647             table => 'rbnf',
2648             by => [qw( locale grouping ruleset )],
2649             }, @_ ) ); }
2650              
2651             sub reference { return( shift->_fetch_one({
2652 1     1 1 9501 id => 'get_ref',
2653             field => 'code',
2654             table => 'refs',
2655             }, @_ ) ); }
2656              
2657             sub references { return( shift->_fetch_all({
2658 1     1 1 8173 id => 'refs',
2659             table => 'refs',
2660             }, @_ ) ); }
2661              
2662             sub script { return( shift->_fetch_one({
2663 1     1 1 8689 id => 'get_script',
2664             field => 'script',
2665             table => 'scripts',
2666             }, @_ ) ); }
2667              
2668             sub scripts { return( shift->_fetch_all({
2669 4     4 1 34202 id => 'scripts',
2670             table => 'scripts',
2671             by => [qw( rtl origin_country likely_language )],
2672             has_status => 1,
2673             }, @_ ) ); }
2674              
2675             sub script_l10n { return( shift->_fetch_one({
2676 1     1 1 10215 id => 'get_script_l10n',
2677             field => 'script',
2678             table => 'scripts_l10n',
2679             requires => [qw( locale alt )],
2680             default => { alt => undef },
2681             }, @_ ) ); }
2682              
2683             sub scripts_l10n { return( shift->_fetch_all({
2684 3     3 1 45269 id => 'scripts_l10n',
2685             table => 'scripts_l10n',
2686             by => [qw( locale alt )],
2687             }, @_ ) ); }
2688              
2689             sub split_interval
2690             {
2691 0     0 1 0 my $self = shift( @_ );
2692 0         0 my $opts = $self->_get_args_as_hash( @_ );
2693             my $greatest_diff = $opts->{greatest_diff} ||
2694 0   0     0 return( $self->error( "No 'greatest_diff' argument value was provided." ) );
2695             my $pat = $opts->{pattern} ||
2696 0   0     0 return( $self->error( "No pattern was provided." ) );
2697             # {0} – {1}
2698 0 0       0 if( $pat =~ /^(?<p1>\{\d\})(?<sep>[^\{]+)(?<p2>\{\d\})$/ )
2699             {
2700 0         0 return( [ $+{p1}, $+{sep}, $+{p2} ] );
2701             }
2702             # First, remove the quoted literals from our string so they do not interfer
2703 0         0 my $literals = {};
2704 0         0 my $spaces = [];
2705 0 0       0 if( index( $pat, "'" ) != -1 )
2706             {
2707 0         0 my $n = 0;
2708 0         0 $pat =~ s{
2709             (?<!\')(\'(?:[^\']+(?!=\'))\')
2710             }
2711             {
2712 0 0       0 if( !exists( $literals->{ $1 } ) )
2713             {
2714 0         0 $literals->{ $1 } = ++$n;
2715             }
2716 0         0 $literals->{ $1 } . '__';
2717             }gexs;
2718             }
2719 0         0 $pat =~ s{
2720             ([[:blank:]\h]+)
2721             }
2722             {
2723 0         0 push( @$spaces, $1 );
2724 0         0 ' ';
2725             }gexs;
2726 0         0 my $len = length( $pat );
2727 0         0 my $matches = {};
2728 0         0 my( $part1, $part2, $sep );
2729 0         0 my $equivalent =
2730             {
2731             'L' => 'M',
2732             'LL' => 'MM',
2733             'LLL' => 'MMM',
2734             'LLLL' => 'MMMM',
2735             'LLLLL' => 'MMMMM',
2736             'LLLLLL' => 'MMMMMM',
2737             'M' => 'L',
2738             'MM' => 'LL',
2739             'MMM' => 'LLL',
2740             'MMMM' => 'LLLL',
2741             'MMMM' => 'LLLLL',
2742             'MMMMM' => 'LLLLLL',
2743             };
2744 0         0 OUTER: for( my $i = 0; $i < $len; $i++ )
2745             {
2746 0         0 INNER: for( my $j = 1; $j < ( $len - $i ); $j++ )
2747             {
2748 0         0 my $check = substr( $pat, $i, $j );
2749 0 0       0 next OUTER if( $check =~ /^[^a-zA-Z]$/ );
2750 0         0 my $pos = index( $pat, $check, $i + length( $check ) );
2751 0 0 0     0 if( exists( $equivalent->{ $check } ) &&
2752             $pos == -1 )
2753             {
2754 0         0 $pos = index( $pat, $equivalent->{ $check }, $i + length( $equivalent->{ $check } ) );
2755 0 0       0 $check = $equivalent->{ $check } if( $pos != -1 );
2756             }
2757 0 0       0 if( $pos != -1 )
2758             {
2759 0         0 $matches->{ substr( $pat, $pos, length( $check ) ) } = [$i, $pos];
2760             }
2761             }
2762             }
2763              
2764 0 0       0 if( !scalar( keys( %$matches ) ) )
2765             {
2766 0 0       0 warn( "Failed to find the repeating field in pattern '${pat}'" ) if( warnings::enabled() );
2767 0         0 return( [] );
2768             }
2769 0         0 my @bests = sort{ length( $b ) <=> length( $a ) } keys( %$matches );
  0         0  
2770 0         0 my $max_len = length( $bests[0] );
2771 0         0 my $best;
2772 0 0 0     0 if( scalar( @bests ) > 1 && length( $bests[1] ) == $max_len )
2773             {
2774 0         0 my $found;
2775 0         0 foreach my $this ( @bests )
2776             {
2777 0 0       0 if( index( $this, $greatest_diff ) != -1 )
2778             {
2779 0         0 $found = $this;
2780 0         0 last;
2781             }
2782             }
2783              
2784 0 0       0 if( !defined( $found ) )
2785             {
2786 0         0 return( $self->error( "Found ", scalar( @bests ), " candidates, but none had the greatest difference field ${greatest_diff}" ) );
2787             }
2788             else
2789             {
2790 0         0 $best = $found;
2791             }
2792             }
2793             else
2794             {
2795 0         0 $best = $bests[0];
2796             }
2797 0         0 my( $start1, $start2 ) = @{$matches->{ $best }};
  0         0  
2798 0         0 $part1 = substr( $pat, 0, ( $start1 + length( $best ) ) );
2799 0         0 $part2 = substr( $pat, $start2 );
2800 0         0 $sep = substr( $pat, $start1 + length( $best ), ( $start2 - ( $start1 + length( $best ) ) ) );
2801              
2802 0 0       0 if( scalar( @$spaces ) )
2803             {
2804 0         0 my $c = 0;
2805 0         0 for( $part1, $sep, $part2 )
2806             {
2807 0         0 s/([[:blank:]\h]+)/$spaces->[$c++]/g;
2808             }
2809             }
2810              
2811 0 0       0 if( scalar( keys( %$literals ) ) )
2812             {
2813 0         0 my $vals = { map{ $literals->{ $_ } => $_ } keys( %$literals ) };
  0         0  
2814 0         0 for( $part1, $part2, $sep )
2815             {
2816 0         0 s/(\d+)__/$vals->{ $1 }/g;
2817             }
2818             }
2819              
2820 0         0 return( [ $part1, $sep, $part2, $best ] );
2821             }
2822              
2823             sub subdivision { return( shift->_fetch_one({
2824 1     1 1 8144 id => 'get_subdivision',
2825             field => 'subdivision',
2826             table => 'subdivisions',
2827             }, @_ ) ); }
2828              
2829             sub subdivisions { return( shift->_fetch_all({
2830 4     4 1 28441 id => 'subdivisions',
2831             table => 'subdivisions',
2832             by => [qw( territory parent is_top_level )],
2833             has_status => 1,
2834             }, @_ ) ); }
2835              
2836             sub subdivision_l10n { return( shift->_fetch_one({
2837 1     1 1 14784 id => 'get_subdivision_l10n',
2838             field => 'subdivision',
2839             table => 'subdivisions_l10n',
2840             requires => [qw( locale )],
2841             }, @_ ) ); }
2842              
2843             sub subdivisions_l10n { return( shift->_fetch_all({
2844 2     2 1 294121 id => 'subdivisions_l10n',
2845             table => 'subdivisions_l10n',
2846             by => [qw( locale )],
2847             }, @_ ) ); }
2848              
2849             sub territory { return( shift->_fetch_one({
2850 1     1 1 14949 id => 'get_territory',
2851             field => 'territory',
2852             table => 'territories',
2853             has_array => [qw( languages contains calendars weekend )],
2854             }, @_ ) ); }
2855              
2856             sub territories { return( shift->_fetch_all({
2857 2     2 1 28360 id => 'territories',
2858             table => 'territories',
2859             by => [qw( parent alt )],
2860             has_status => 1,
2861             has_array => [qw( languages contains calendars weekend )],
2862             }, @_ ) ); }
2863              
2864             sub territory_l10n { return( shift->_fetch_one({
2865 1     1 1 9209 id => 'get_territory_l10n',
2866             field => 'territory',
2867             table => 'territories_l10n',
2868             requires => [qw( locale alt )],
2869             default => { alt => undef },
2870             }, @_ ) ); }
2871              
2872             sub territories_l10n { return( shift->_fetch_all({
2873 3     3 1 117898 id => 'territories_l10n',
2874             table => 'territories_l10n',
2875             by => [qw( locale alt )],
2876             }, @_ ) ); }
2877              
2878             sub time_format { return( shift->_fetch_one({
2879 1     1 1 10215 id => 'get_time_format',
2880             field => 'region',
2881             table => 'time_formats',
2882             has_array => [qw( time_allowed )],
2883             }, @_ ) ); }
2884              
2885             sub time_formats { return( shift->_fetch_all({
2886 5     5 1 18513 id => 'time_formats',
2887             table => 'time_formats',
2888             by => [qw( region territory locale )],
2889             has_array => [qw( time_allowed )],
2890             }, @_ ) ); }
2891              
2892             sub time_relative_l10n { return( shift->_fetch_one({
2893 0     0 1 0 id => 'get_time_relative_l10n',
2894             field => 'relative',
2895             table => 'time_relative_l10n',
2896             requires => [qw( locale field_type field_length count )],
2897             default => { count => 'one' },
2898             }, @_ ) ); }
2899              
2900             sub time_relatives_l10n { return( shift->_fetch_all({
2901 0     0 1 0 id => 'time_relative_l10n',
2902             table => 'time_relative_l10n',
2903             by => [qw( locale field_type field_length count )],
2904             }, @_ ) ); }
2905              
2906             sub timezone { return( shift->_fetch_one({
2907 1     1 1 6415 id => 'get_timezone',
2908             field => 'timezone',
2909             table => 'timezones',
2910             has_array => [qw( alias )],
2911             }, @_ ) ); }
2912              
2913             sub timezones { return( shift->_fetch_all({
2914 7     7 1 28268 id => 'timezones',
2915             table => 'timezones',
2916             by => [qw( territory region tzid tz_bcpid metazone is_golden is_primary is_canonical )],
2917             has_array => [qw( alias )],
2918             }, @_ ) ); }
2919              
2920             sub timezone_canonical
2921             {
2922 4     4 1 25738 my $self = shift( @_ );
2923 4   50     25 my $tz = shift( @_ ) ||
2924             return( $self->error( "No timezone was provided to get its canonical version." ) );
2925 4   50     21 my $dbh = $self->_dbh || return( $self->pass_error );
2926 4         11 my $sth_id = 'sth_get_timezone';
2927 4         10 local $@;
2928 4         8 my $sth;
2929 4 100       22 unless( $sth = $self->_get_cached_statement( $sth_id ) )
2930             {
2931             # try-catch
2932             $sth = eval
2933 1   50     7 {
2934             $dbh->prepare( "SELECT * FROM timezones WHERE timezone = ?" )
2935             } || return( $self->error( "Unable to prepare SQL query with statement ID ${sth_id} to retrieve the given timezone information: ", ( $@ || $dbh->errstr ) ) );
2936 1         361 $self->_set_cached_statement( $sth_id => $sth );
2937             }
2938              
2939             # try-catch
2940             eval
2941             {
2942 4         226 $sth->execute( $tz );
2943 4 50 0     12 } || return( $self->error( "Error executing SQL query '$sth->{Statement}' with statement ID ${sth_id} to retrieve the given timezone information:", ( $@ || $sth->errstr ), " with SQL query: ", $sth->{Statement} ) );
2944 4         252 my $ref = $sth->fetchrow_hashref;
2945 4 50       31 return( $self->error( "No timezone '${tz}' exists in the Locale::Unicode::Data database." ) ) if( !$ref );
2946 4         7 $self->_decode_utf8( $ref ) if( MISSING_AUTO_UTF8_DECODING );
2947 4         30 $self->_decode_sql_arrays( ['alias'], $ref );
2948 4 100 33     39 if( $ref->{is_canonical} )
    50 50        
2949             {
2950 1         12 return( $ref->{timezone} );
2951             }
2952             elsif( $ref->{alias} &&
2953             ref( $ref->{alias} ) eq 'ARRAY' &&
2954 3         18 scalar( @{$ref->{alias}} ) )
2955             {
2956 3         7 $sth_id = 'sth_get_timezone_multi_' . scalar( @{$ref->{alias}} );
  3         12  
2957 3 100       12 unless( $sth = $self->_get_cached_statement( $sth_id ) )
2958             {
2959             # try-catch
2960             $sth = eval
2961             {
2962             $dbh->prepare( "SELECT * FROM timezones WHERE " . join( ' OR ', map{ "timezone = ?" } @{$ref->{alias}} ) )
2963 2   50     7 } || return( $self->error( "Unable to prepare SQL query with statement ID ${sth_id} to retrieve one of " . scalar( @{$ref->{alias}} ) . " timezone(s) information: ", ( $@ || $dbh->errstr ) ) );
2964 2         463 $self->_set_cached_statement( $sth_id => $sth );
2965             }
2966             # try-catch
2967             eval
2968             {
2969 3         7 $sth->execute( @{$ref->{alias}} );
  3         210  
2970 3 50 0     8 } || return( $self->error( "Error executing SQL query '$sth->{Statement}' with statement ID ${sth_id} to retrieve one of " . scalar( @{$ref->{alias}} ) . " timezone(s) information:", ( $@ || $sth->errstr ), " with SQL query: ", $sth->{Statement} ) );
  0         0  
2971 3         41 my $all = $sth->fetchall_arrayref({});
2972 3         665 foreach my $this ( @$all )
2973             {
2974 3 50       67 return( $this->{timezone} ) if( $this->{is_canonical} );
2975             }
2976             }
2977 0         0 return( '' );
2978             }
2979              
2980             sub timezone_city
2981             {
2982 1     1 1 10922 my $self = shift( @_ );
2983 1         7 my $is_extended = $self->extend_timezones_cities;
2984 1 50       66 return( $self->_fetch_one({
2985             id => 'get_timezone_city',
2986             field => 'timezone',
2987             table => ( $is_extended ? 'timezones_cities_extended' : 'timezones_cities' ),
2988             requires => [qw( locale alt )],
2989             default => { alt => undef },
2990             }, @_ ) );
2991             }
2992              
2993             sub timezones_cities
2994             {
2995 1     1 1 8150 my $self = shift( @_ );
2996 1         8 my $is_extended = $self->extend_timezones_cities;
2997 1 50       11 return( $self->_fetch_all({
2998             id => 'timezones_cities',
2999             table => ( $is_extended ? 'timezones_cities_extended' : 'timezones_cities' ),
3000             by => [qw( locale alt )],
3001             }, @_ ) );
3002             }
3003              
3004             sub timezone_formats { return( shift->_fetch_one({
3005 7     7 1 183862 id => 'get_timezone_formats',
3006             field => 'type',
3007             table => 'timezones_formats',
3008             requires => [qw( locale subtype )],
3009             default => { subtype => undef },
3010             }, @_ ) ); }
3011              
3012             sub timezones_formats { return( shift->_fetch_all({
3013 1     1 1 9039 id => 'timezones_formats',
3014             table => 'timezones_formats',
3015             by => [qw( locale type subtype format_pattern )],
3016             }, @_ ) ); }
3017              
3018             sub timezone_info { return( shift->_fetch_one({
3019 2     2 1 17557 id => 'get_timezone_info',
3020             field => 'timezone',
3021             table => 'timezones_info',
3022             requires => [qw( start )],
3023             default => { start => undef },
3024             }, @_ ) ); }
3025              
3026             sub timezones_info { return( shift->_fetch_all({
3027 5     5 1 11750 id => 'timezones_info',
3028             table => 'timezones_info',
3029             by => [qw( timezone metazone start until )],
3030             }, @_ ) ); }
3031              
3032             sub timezone_names { return( shift->_fetch_one({
3033 2     2 1 6086 id => 'get_timezone_names',
3034             field => 'timezone',
3035             table => 'timezones_names',
3036             requires => [qw( locale width )],
3037             default => { start => undef },
3038             }, @_ ) ); }
3039              
3040             sub timezones_names { return( shift->_fetch_all({
3041 1     1 1 6918 id => 'timezones_names',
3042             table => 'timezones_names',
3043             by => [qw( locale timezone width )],
3044             }, @_ ) ); }
3045              
3046             sub unit_alias { return( shift->_fetch_one({
3047 2     2 1 10797 id => 'get_unit_alias',
3048             field => 'alias',
3049             table => 'unit_aliases',
3050             }, @_ ) ); }
3051              
3052             sub unit_aliases { return( shift->_fetch_all({
3053 1     1 1 6330 id => 'unit_aliases',
3054             table => 'unit_aliases',
3055             }, @_ ) ); }
3056              
3057             sub unit_constant { return( shift->_fetch_one({
3058 0     0 1 0 id => 'get_unit_constant',
3059             field => 'constant',
3060             table => 'unit_constants',
3061             }, @_ ) ); }
3062              
3063             sub unit_constants { return( shift->_fetch_all({
3064 0     0 1 0 id => 'unit_constants',
3065             table => 'unit_constants',
3066             }, @_ ) ); }
3067              
3068             sub unit_conversion { return( shift->_fetch_one({
3069 1     1 1 9346 id => 'get_unit_conversion',
3070             field => 'source',
3071             table => 'unit_conversions',
3072             has_array => [qw( systems )],
3073             }, @_ ) ); }
3074              
3075             sub unit_conversions { return( shift->_fetch_all({
3076 3     3 1 25165 id => 'unit_conversions',
3077             table => 'unit_conversions',
3078             by => [qw( base_unit category )],
3079             has_array => [qw( systems )],
3080             }, @_ ) ); }
3081              
3082             sub unit_l10n { return( shift->_fetch_one({
3083 1     1 1 6622 id => 'get_unit_l10n',
3084             field => 'unit_id',
3085             table => 'units_l10n',
3086             requires => [qw( locale format_length unit_type count gender gram_case )],
3087             default => { count => undef, gender => undef, gram_case => undef },
3088             }, @_ ) ); }
3089              
3090             sub units_l10n { return( shift->_fetch_all({
3091 3     3 1 411809 id => 'units_l10n',
3092             table => 'units_l10n',
3093             by => [qw( locale format_length unit_type unit_id pattern_type count gender gram_case )],
3094             }, @_ ) ); }
3095              
3096             sub unit_prefix { return( shift->_fetch_one({
3097 1     1 1 10945 id => 'get_unit_prefix',
3098             field => 'unit_id',
3099             table => 'unit_prefixes',
3100             }, @_ ) ); }
3101              
3102             sub unit_prefixes { return( shift->_fetch_all({
3103 1     1 1 10767 id => 'unit_prefixes',
3104             table => 'unit_prefixes',
3105             }, @_ ) ); }
3106              
3107             sub unit_pref { return( shift->_fetch_one({
3108 1     1 1 8940 id => 'get_unit_pref',
3109             field => 'unit_id',
3110             table => 'unit_prefs',
3111             }, @_ ) ); }
3112              
3113             sub unit_prefs { return( shift->_fetch_all({
3114 3     3 1 20288 id => 'unit_prefs',
3115             table => 'unit_prefs',
3116             by => [qw( territory category )],
3117             }, @_ ) ); }
3118              
3119             sub unit_quantity { return( shift->_fetch_one({
3120 1     1 1 9933 id => 'get_unit_quantity',
3121             field => 'base_unit',
3122             table => 'unit_quantities',
3123             }, @_ ) ); }
3124              
3125             sub unit_quantities { return( shift->_fetch_all({
3126 2     2 1 12690 id => 'unit_quantities',
3127             table => 'unit_quantities',
3128             by => [qw( quantity )],
3129             has_status => 1,
3130             }, @_ ) ); }
3131              
3132             sub variant { return( shift->_fetch_one({
3133 1     1 1 10073 id => 'get_variant',
3134             field => 'variant',
3135             table => 'variants',
3136             }, @_ ) ); }
3137              
3138             sub variants { return( shift->_fetch_all({
3139 1     1 1 6194 id => 'variants',
3140             table => 'variants',
3141             has_status => 1,
3142             }, @_ ) ); }
3143              
3144             sub variant_l10n { return( shift->_fetch_one({
3145 1     1 1 7989 id => 'get_variant_l10n',
3146             field => 'variant',
3147             table => 'variants_l10n',
3148             requires => [qw( locale alt )],
3149             default => { alt => undef },
3150             }, @_ ) ); }
3151              
3152             sub variants_l10n { return( shift->_fetch_all({
3153 2     2 1 26123 id => 'variants_l10n',
3154             table => 'variants_l10n',
3155             by => [qw( locale alt )],
3156             }, @_ ) ); }
3157              
3158             sub week_preference { return( shift->_fetch_one({
3159 1     1 1 8866 id => 'get_week_preference',
3160             field => 'locale',
3161             table => 'week_preferences',
3162             has_array => [qw( ordering )],
3163             }, @_ ) ); }
3164              
3165             sub week_preferences { return( shift->_fetch_all({
3166 1     1 1 7218 id => 'week_preferences',
3167             table => 'week_preferences',
3168             has_array => [qw( ordering )],
3169             }, @_ ) ); }
3170              
3171             sub _dbh
3172             {
3173 246     246   541 my $self = shift( @_ );
3174 246         656 my $opts = $self->_get_args_as_hash( @_ );
3175 246   33     959 my $file = $opts->{datafile} || $self->datafile || $DB_FILE;
3176 246         384 my $dbh;
3177 246 50 33     7221 if( $DBH &&
      66        
      66        
      33        
      33        
      33        
3178             ref( $DBH ) eq 'HASH' &&
3179             exists( $DBH->{ $file } ) &&
3180             $DBH->{ $file } &&
3181             Scalar::Util::blessed( $DBH->{ $file } ) &&
3182             $DBH->{ $file }->isa( 'DBI::db' ) &&
3183             $DBH->{ $file }->ping )
3184             {
3185 242         17560 return( $DBH->{ $file } );
3186             }
3187              
3188              
3189 4 50       358 if( !-e( $file ) )
    50          
    50          
    50          
    50          
3190             {
3191 0         0 return( $self->error( "Unicode CLDR SQLite database file ${file} does not exist!" ) );
3192             }
3193             elsif( !-f( $file ) )
3194             {
3195 0         0 return( $self->error( "Unicode CLDR SQLite database file ${file} is not a regular file." ) );
3196             }
3197             elsif( -z( $file ) )
3198             {
3199 0         0 return( $self->error( "Unicode CLDR SQLite database file ${file} is empty!" ) );
3200             }
3201             elsif( !-r( $file ) )
3202             {
3203 0         0 return( $self->error( "Unicode CLDR SQLite database file ${file} is not readable by uid $>" ) );
3204             }
3205             elsif( version->parse( $DBD::SQLite::sqlite_version ) < version->parse( '3.6.19' ) )
3206             {
3207 0         0 return( $self->error( "SQLite driver version 3.6.19 or higher is required. You have version ", $DBD::SQLite::sqlite_version ) );
3208             }
3209              
3210 4         20 if( HAS_CONSTANTS )
3211             {
3212 4         4151 require DBD::SQLite::Constants;
3213             }
3214              
3215 4         6911 my $params =
3216             {
3217             ( HAS_CONSTANTS ? ( sqlite_open_flags => DBD::SQLite::Constants::SQLITE_OPEN_READONLY ) : () ),
3218             };
3219 4   50     60 $dbh = DBI->connect( "dbi:SQLite:dbname=${file}", '', '', $params ) ||
3220             return( $self->error( "Unable to make connection to Unicode CLDR SQLite database file ${file}: ", $DBI::errstr ) );
3221             # See: <https://metacpan.org/release/ADAMK/DBD-SQLite-1.27/view/lib/DBD/SQLite.pm#Foreign-Keys>
3222 4         47120 $dbh->do("PRAGMA foreign_keys = ON");
3223             # UTF-8 decoding is done natively from version 1.68 onward
3224 4         167 if( !MISSING_AUTO_UTF8_DECODING )
3225             {
3226 4         29 $dbh->{sqlite_string_mode} = DBD::SQLite::Constants::DBD_SQLITE_STRING_MODE_UNICODE_FALLBACK;
3227             }
3228 4         34 return( $DBH->{ $file } = $dbh );
3229             }
3230              
3231             sub _decode_sql_arrays
3232             {
3233 272848     272848   344928 my $self = shift( @_ );
3234 272848 50       429317 die( "\$cldr->_decode_sql_arrays( \$array_ref_of_array_fields, \$data )" ) if( @_ != 2 );
3235 272848         381853 my( $where, $ref ) = @_;
3236 272848 50 50     849898 if( ref( $where ) ne 'ARRAY' )
    50 50        
      66        
3237             {
3238 0         0 die( "\$cldr->_decode_sql_arrays( \$array_ref_of_array_fields, \$data )" );
3239             }
3240             elsif( ref( $ref // '' ) ne 'HASH' && Scalar::Util::reftype( $ref // '' ) ne 'ARRAY' )
3241             {
3242 0         0 die( "\$cldr->_decode_sql_arrays( \$array_ref_of_array_fields, \$data )" );
3243             }
3244              
3245 272848         738466 my $j = JSON->new->relaxed;
3246 272848         325523 local $@;
3247 272848 100       411364 if( ref( $ref ) eq 'HASH' )
    50          
3248             {
3249 272631         369940 foreach my $field ( @$where )
3250             {
3251 282796 100 66     1290851 if( exists( $ref->{ $field } ) &&
      66        
3252             defined( $ref->{ $field } ) &&
3253             length( $ref->{ $field } ) )
3254             {
3255             my $decoded = eval
3256 254466         344405 {
3257 254466         1453230 $j->decode( $ref->{ $field } );
3258             };
3259 254466 50       409467 if( $@ )
3260             {
3261 0         0 warn( "Warning only: error attempting to decode JSON array in field \"${field}\" for value '", $ref->{ $field }, "': $@" );
3262 0         0 $ref->{ $field } = [];
3263             }
3264             else
3265             {
3266 254466         485543 $ref->{ $field } = $decoded;
3267             }
3268             }
3269             }
3270             }
3271             elsif( Scalar::Util::reftype( $ref ) eq 'ARRAY' )
3272             {
3273 217         689 for( my $i = 0; $i < scalar( @$ref ); $i++ )
3274             {
3275 272154 50       536944 if( ref( $ref->[$i] ) ne 'HASH' )
3276             {
3277 0         0 warn( "SQL data at offset ${i} is not an HASH reference." );
3278 0         0 next;
3279             }
3280 272154         452374 $self->_decode_sql_arrays( $where, $ref->[$i] );
3281             }
3282             }
3283 272848         889677 return( $ref );
3284             }
3285              
3286             sub _decode_utf8
3287             {
3288 0     0   0 my $self = shift( @_ );
3289 0         0 my $this = shift( @_ );
3290 0 0       0 if( ref( $this ) eq 'HASH' )
    0          
    0          
3291             {
3292 0         0 foreach my $k ( keys( %$this ) )
3293             {
3294 0 0       0 next if( !defined( $this->{ $k } ) );
3295 0 0 0     0 if( ref( $this->{ $k } ) eq 'ARRAY' ||
3296             !ref( $this->{ $k } ) )
3297             {
3298 0         0 $this->{ $k } = $self->_decode_utf8( $this->{ $k } );
3299             }
3300             }
3301             }
3302             elsif( ref( $this ) eq 'ARRAY' )
3303             {
3304 0         0 for( my $i = 0; $i < scalar( @$this ); $i++ )
3305             {
3306 0 0       0 next if( !defined( $this->[$i] ) );
3307 0 0 0     0 if( ref( $this->[$i] ) eq 'HASH' ||
3308             !ref( $this->[$i] ) )
3309             {
3310 0         0 $this->[$i] = $self->_decode_utf8( $this->[$i] );
3311             }
3312             }
3313             }
3314             elsif( !ref( $this ) )
3315             {
3316             my $val = eval
3317 0         0 {
3318 0         0 Encode::decode_utf8( $this, Encode::FB_CROAK );
3319             };
3320 0 0       0 if( $@ )
3321             {
3322 0 0       0 warn( "Error utf-8 decoding: $@" ) if( warnings::enabled() );
3323 0         0 return( $this );
3324             }
3325             else
3326             {
3327 0         0 return( $val );
3328             }
3329             }
3330 0         0 return( $this );
3331             }
3332              
3333             sub _fetch_all
3334             {
3335 345     345   825 my $self = shift( @_ );
3336 345   50     1206 my $def = shift( @_ ) || return( $self->error( "No hash definition provided." ) );
3337 345 50       1155 return( $self->error( "Hash definition is not an hash reference." ) ) if( ref( $def ) ne 'HASH' );
3338 345   50     1248 my $table = $def->{table} || return( $self->error( "No SQL table name was provided." ) );
3339 345   33     1099 my $id = $def->{id} || $table;
3340 345   33     1576 my $what = $def->{what} || $table;
3341 345 100       1083 my $order = exists( $def->{order} ) ? $def->{order} : 'rowid';
3342 345         1387 my $opts = $self->_get_args_as_hash( @_ );
3343             my $status = $def->{has_status}
3344             ? $def->{has_status} =~ /[a-zA-Z]/
3345             ? $def->{has_status}
3346 345 50       1459 : 'status'
    100          
3347             : undef;
3348 345 100 66     2310 my $by = ( exists( $def->{by} ) && ref( $def->{by} ) eq 'ARRAY' ? $def->{by} : [] );
3349 345         627 my $order_by_value = [];
3350 345 50 33     1230 if( exists( $opts->{order_by_value} ) &&
3351             defined( $opts->{order_by_value} ) )
3352             {
3353 0 0       0 if( ref( $opts->{order_by_value} ) eq 'ARRAY' )
3354             {
3355 0         0 $order_by_value = $opts->{order_by_value};
3356             }
3357             else
3358             {
3359 0         0 $order_by_value = [$opts->{order_by_value}];
3360             }
3361             }
3362              
3363 345 50       992 if( scalar( @$order_by_value ) )
3364             {
3365 0 0       0 if( scalar( @$order_by_value ) != 2 )
    0          
    0          
3366             {
3367 0         0 die( "Invalid number of parameter for order by field value. You need to provide a field name and an array reference of values." );
3368             }
3369             elsif( ref( $order_by_value->[1] ) ne 'ARRAY' )
3370             {
3371 0         0 die( "Invalid parameters provided for order by field value. The second parameter must be an array reference of value to sort with." );
3372             }
3373 0         0 elsif( !scalar( @{$order_by_value->[1]} ) )
3374             {
3375 0   0     0 die( "The array of value to sort the data for field '", ( $order_by_value->[0] // 'undef' ), "' is empty." );
3376             }
3377 0         0 my $field = $order_by_value->[0];
3378 0         0 my @cases;
3379 0         0 for( my $i = 0; $i < scalar( @{$order_by_value->[1]} ); $i++ )
  0         0  
3380             {
3381 0         0 push( @cases, sprintf( "WHEN '%s' THEN %d", $order_by_value->[1]->[$i], $i ) );
3382             }
3383 0         0 my $case = "CASE ${field} " . join( ' ', @cases ) . ' END';
3384 0         0 $order = $case;
3385             }
3386             # order option to override any default order directive
3387 345 50       1157 if( exists( $opts->{order} ) )
3388             {
3389 0         0 my( $field, $datatype );
3390 0 0       0 if( ref( $opts->{order} ) eq 'HASH' )
    0          
3391             {
3392 0         0 my @keys = keys( %{$opts->{order}} );
  0         0  
3393 0 0       0 if( scalar( @keys ) != 1 )
3394             {
3395 0         0 local $" = ', ';
3396 0         0 die( "You can only specify one order field to cast. Here, you provided: @keys" );
3397             }
3398 0         0 ( $field, $datatype ) = ( $keys[0], $opts->{order}->{ $keys[0] } );
3399             }
3400             elsif( ref( $opts->{order} ) eq 'ARRAY' )
3401             {
3402 0 0       0 if( scalar( @{$opts->{order}} ) != 2 )
  0         0  
3403             {
3404 0         0 die( "You need to provide a 2-elements array. The first element is the field name and the second element the data type. You provided ", scalar( @{$opts->{order}} ), " element(s)." );
  0         0  
3405             }
3406 0         0 ( $field, $datatype ) = @{$opts->{order}};
  0         0  
3407             }
3408             else
3409             {
3410 0         0 $field = $opts->{order};
3411             }
3412              
3413 0 0 0     0 if( defined( $field ) && defined( $datatype ) )
    0          
3414             {
3415 0 0 0     0 if( !length( $field // '' ) )
    0 0        
    0          
    0          
3416             {
3417 0         0 die( "The order field value provided is empty!" );
3418             }
3419             elsif( !length( $datatype // '' ) )
3420             {
3421 0         0 die( "The order datatype value provided is empty!" );
3422             }
3423             elsif( $field !~ /^[a-zA-Z0-9\_]+$/ )
3424             {
3425 0         0 die( "The order field name provided contains illegal value. It must be an alphanumerical string, with possible '_' character." );
3426             }
3427             elsif( $datatype !~ /^[a-zA-Z0-9]+$/ )
3428             {
3429 0         0 die( "The order field data type contains an illegal value. It must be a string of alpha numeric characters." );
3430             }
3431 0         0 $order = "CAST(${field} AS \U${datatype}\E)";
3432             }
3433             elsif( defined( $field ) )
3434             {
3435 0 0 0     0 die( "The order field value provided is empty!" ) if( !length( $field // '' ) );
3436 0 0       0 if( $field !~ /^[a-zA-Z0-9\_]+$/ )
3437             {
3438 0         0 die( "The order field name provided contains illegal value. It must be an alphanumerical string, with possible '_' character." );
3439             }
3440             }
3441             }
3442 345 100 66     1736 my $sql_arrays_in = ( exists( $def->{has_array} ) && ref( $def->{has_array} ) eq 'ARRAY' ? $def->{has_array} : [] );
3443 345         720 my $sth;
3444 345         1584 my $op_map =
3445             {
3446             '=' => 'IS',
3447             '!=' => 'IS NOT',
3448             };
3449 345         688 my $by_values = [];
3450 345         562 my $skeleton = [];
3451 345         545 my $by_keys = [];
3452 345 100       915 if( scalar( @$by ) )
3453             {
3454 334         1127 for( @$by )
3455             {
3456 1213 50       5839 return( $self->error( "Table field provided '$_' contains illegal characters." ) ) if( $_ !~ /^[a-z][a-z0-9]+(?:\_[a-z][a-z0-9]+)*$/ );
3457 1213 100       3158 next unless( exists( $opts->{ $_ } ) );
3458 318 50 100     1499 if( ref( $opts->{ $_ } // '' ) eq 'ARRAY' )
3459             {
3460 0         0 my $and_skels = [];
3461 0         0 for( my $i = 0; $i < scalar( @{$opts->{ $_ }} ); $i++ )
  0         0  
3462             {
3463 0         0 my $op = '=';
3464 0         0 my $val = $opts->{ $_ }->[$i];
3465 0 0 0     0 if( defined( $val ) &&
    0 0        
3466             $val =~ s/^[[:blank:]\h]*(?<op>\<|\<=|\>|\>=|=|\!=|\~)[[:blank:]\h]*(?<val>.*?)$/$+{val}/ )
3467             {
3468 0         0 $op = $+{op};
3469             }
3470             elsif( defined( $val ) &&
3471             ref( $val ) eq 'Regexp' )
3472             {
3473 0         0 $op = '~';
3474 0         0 $val =~ s/^\(\?[^\:]+\:(.*?)\)$/$1/;
3475             }
3476              
3477 0 0       0 $op = $op_map->{ $op } if( exists( $op_map->{ $op } ) );
3478 0 0       0 if( $op eq '~' )
3479             {
3480 0         0 push( @$and_skels, "$_ REGEXP(?)" );
3481 0         0 push( @$by_keys, "regexp_${_}" );
3482             }
3483             else
3484             {
3485 0         0 push( @$and_skels, "$_ ${op} ?" );
3486 0         0 push( @$by_keys, "${op}${_}" );
3487             }
3488 0 0 0     0 push( @$by_values, defined( $val ) ? ( Scalar::Util::blessed( $val ) && overload::Method( $val => '""' ) ) ? "$val" : $val : $val );
    0          
3489             }
3490 0         0 push( @$skeleton, '( ' . join( ' OR ', @$and_skels ) . ' )' );
3491             }
3492             else
3493             {
3494 318         616 my $op = '=';
3495 318         723 my $val = $opts->{ $_ };
3496 318 50 66     3125 if( defined( $val ) &&
    100 100        
3497             $val =~ s/^[[:blank:]\h]*(?<op>\<|\<=|\>|\>=|=|\!=|\~)[[:blank:]\h]*(?<val>.*?)$/$+{val}/ )
3498             {
3499 0         0 $op = $+{op};
3500             }
3501             elsif( defined( $val ) &&
3502             ref( $val ) eq 'Regexp' )
3503             {
3504 1         3 $op = '~';
3505 1         8 $val =~ s/^\(\?[^\:]+\:(.*?)\)$/$1/;
3506             }
3507              
3508 318 100       1136 $op = $op_map->{ $op } if( exists( $op_map->{ $op } ) );
3509 318 100       733 if( $op eq '~' )
3510             {
3511 1         4 push( @$skeleton, "$_ REGEXP(?)" );
3512 1         2 push( @$by_keys, "regexp_${_}" );
3513             }
3514             else
3515             {
3516 317         1105 push( @$skeleton, "$_ ${op} ?" );
3517 317         974 push( @$by_keys, "${op}${_}" );
3518             }
3519 318 50 33     1626 push( @$by_values, defined( $val ) ? ( Scalar::Util::blessed( $val ) && overload::Method( $val => '""' ) ) ? "$val" : $val : $val );
    100          
3520             }
3521             }
3522             }
3523 345 50 66     1022 if( defined( $status ) &&
3524             exists( $opts->{ $status } ) )
3525             {
3526 0         0 push( @$by, $status );
3527 0         0 push( @$by_values, $opts->{ $status } );
3528 0         0 push( @$skeleton, "${status} = ?" );
3529 0         0 push( @$by_keys, "=${status}" );
3530             }
3531              
3532 345         735 my( $has, $has_keys, $has_values );
3533 345 0 50     1079 if( $opts->{has} && scalar( @$sql_arrays_in ) )
3534             {
3535 0         0 my $has_elems = [];
3536 0 0       0 if( ref( $opts->{has} ) eq 'HASH' )
    0          
    0          
3537             {
3538 0         0 @$has_elems = %{$opts->{has}};
  0         0  
3539             }
3540             elsif( ref( $opts->{has} ) eq 'ARRAY' )
3541             {
3542 0         0 $has_elems = $opts->{has};
3543             }
3544             elsif( scalar( @$sql_arrays_in ) == 1 )
3545             {
3546 0         0 $has_elems = [ $sql_arrays_in->[0] => $opts->{has} ];
3547             }
3548             else
3549             {
3550 0   0     0 return( $self->error( "There are ", scalar( @$sql_arrays_in ), " fields with array. You need to specify which one you want to check for value '", ( $opts->{has} // 'undef' ), "'" ) );
3551             }
3552 0         0 $has = [];
3553 0         0 $has_keys = [];
3554 0         0 $has_values = [];
3555 0         0 for( my $i = 0; $i < scalar( @$has_elems ); $i += 2 )
3556             {
3557 0         0 my $f = $has_elems->[$i];
3558 0 0       0 unless( $f =~ /^[a-zA-z][a-zA-z0-9]+$/ )
3559             {
3560 0         0 return( $self->error( "Invalid field name '${f}' for table '${table}'. It should only contain alpha numeric characters." ) );
3561             }
3562 0         0 push( @$has_keys, $f );
3563 0         0 push( @$has_values, $has_elems->[$i + 1] );
3564 0         0 push( @$has, "EXISTS (SELECT * FROM JSON_EACH(${f}) WHERE JSON_EACH.value IS ?)" );
3565             }
3566             }
3567              
3568 345 100       1456 my $by_key = scalar( @$by_keys ) ? join( '_', @$by_keys ) : '';
3569 345 50       1730 my $sth_id = $by_key
    50          
    100          
3570             ? "${id}_with_${by_key}" . ( defined( $has ) ? '_has_' . join( '_', @$has_keys ) : '' ) . "_order_${order}"
3571             : defined( $has )
3572             ? "${id}_with_has_" . join( '_', @$has_keys ) . "_order_${order}"
3573             : "${id}_order_${order}";
3574 345         912 local $" = ', ';
3575 345         655 local $@;
3576 345 100 66     1219 if( $by_key || defined( $has ) )
3577             {
3578 284 100       966 unless( $sth = $self->_get_cached_statement( $sth_id ) )
3579             {
3580 95   50     359 my $dbh = $self->_dbh || return( $self->pass_error );
3581             $sth = eval
3582 95   50     228 {
3583             $dbh->prepare( "SELECT * FROM ${table} WHERE " . join( ' AND ', @$skeleton ) . ( defined( $has ) ? ( ( scalar( @$skeleton ) ? ' AND (' : '' ) . join( ' OR ', @$has ) . ( scalar( @$skeleton ) ? ')' : '' ) ) : '' ) . " ORDER BY ${order}" )
3584             } || return( $self->error( "Unable to prepare SQL query to retrieve all ${what} information for fields @$by: ", ( $@ || $dbh->errstr ) ) );
3585 95         230804 $self->_set_cached_statement( $sth_id => $sth );
3586             }
3587             }
3588             else
3589             {
3590 61 100       305 unless( $sth = $self->_get_cached_statement( $sth_id ) )
3591             {
3592 58   50     224 my $dbh = $self->_dbh || return( $self->pass_error );
3593             $sth = eval
3594 58   50     154 {
3595             $dbh->prepare( "SELECT * FROM ${table} ORDER BY ${order}" )
3596             } || return( $self->error( "Unable to prepare SQL query to retrieve all ${what} information: ", ( $@ || $dbh->errstr ) ) );
3597 58         10294 $self->_set_cached_statement( $sth_id => $sth );
3598             }
3599             }
3600              
3601             eval
3602             {
3603 345 100       454527 $sth->execute( ( scalar( @$by_values ) ? @$by_values : () ), ( defined( $has_values ) ? @$has_values : () ) )
    50          
3604 345 0 0     904 } || return( $self->error( "Error executing SQL query '$sth->{Statement}' to retrieve all ${what}". ( $by_key ? " with fields @$by" : '' ), ": ", ( $@ || $sth->errstr ), " with SQL query: ", $sth->{Statement} ) );
    50          
3605 345         4995 my $all = $sth->fetchall_arrayref({});
3606 345         12769163 $self->_decode_utf8( $all ) if( MISSING_AUTO_UTF8_DECODING );
3607 345 100 50     2066 if( $all && scalar( @$sql_arrays_in ) )
3608             {
3609 216 50       1291 $self->_decode_sql_arrays( $sql_arrays_in, $all ) if( $self->{decode_sql_arrays} );
3610             }
3611 345 50 33     1458 if( !$all && want( 'ARRAY' ) )
3612             {
3613 0         0 return( [] );
3614             }
3615 345         4170 return( $all );
3616             }
3617              
3618             sub _fetch_one
3619             {
3620 571     571   1490 my $self = shift( @_ );
3621 571   50     2460 my $def = shift( @_ ) || return( $self->error( "No hash definition provided." ) );
3622 571 50       2586 return( $self->error( "Hash definition is not an hash reference." ) ) if( ref( $def ) ne 'HASH' );
3623 571   50     2419 my $field = $def->{field} || return( $self->error( "No table field was provided." ) );
3624 571   33     3070 my $what = $def->{what} || $field;
3625 571   50     2013 my $table = $def->{table} || return( $self->error( "No SQL table name was provided." ) );
3626 571   100     2950 my $defaults = $def->{default} || {};
3627 571         2494 my $opts = $self->_get_args_as_hash( @_ );
3628 571 50       2125 return( $self->error( "No ${what} ID provided to retrieve its information." ) ) if( !exists( $opts->{ $field } ) );
3629 571 100       2590 my $id = ref( $opts->{ $field } ) eq 'ARRAY' ? $opts->{ $field } : [$opts->{ $field }];
3630 571 100 66     3946 my $sql_arrays_in = ( exists( $def->{has_array} ) && ref( $def->{has_array} ) eq 'ARRAY' ? $def->{has_array} : [] );
3631             my $requires = exists( $def->{requires} ) && ref( $def->{requires} ) eq 'ARRAY'
3632             ? $def->{requires}
3633 571 100 66     2294 : [];
3634             # my $requires_key = scalar( @$requires ) ? join( '_', @$requires ) : '';
3635 571         1016 my $required_val = [];
3636 571         869 my $required_skel = [];
3637 571         999 my $required_keys = [];
3638             # In SQLite, the expression '= NULL' does not work, and we need to use 'IS NULL'
3639 571         2508 my $op_map =
3640             {
3641             '=' => 'IS',
3642             '!=' => 'IS NOT',
3643             };
3644              
3645 571         1869 for( @$requires )
3646             {
3647 150 50       1031 return( $self->error( "Table field provided '$_' contains illegal characters." ) ) if( $_ !~ /^[a-z][a-z0-9]+(?:\_[a-z][a-z0-9]+)*$/ );
3648 150 100 100     579 $opts->{ $_ } = $defaults->{ $_ } if( !exists( $opts->{ $_ } ) && exists( $defaults->{ $_ } ) );
3649 150 100       346 if( !exists( $opts->{ $_ } ) )
3650             {
3651 1         4 return( $self->error( "No value for $_ was provided." ) );
3652             }
3653            
3654 149 100 100     557 if( ref( $opts->{ $_ } // '' ) eq 'ARRAY' )
3655             {
3656 1         2 my $and_skels = [];
3657 1         3 for( my $i = 0; $i < scalar( @{$opts->{ $_ }} ); $i++ )
  3         10  
3658             {
3659 2         3 my $op = '=';
3660 2         4 my $val = $opts->{ $_ }->[$i];
3661 2 50 33     28 if( defined( $val ) &&
    0 0        
3662             # $opts->{ $_ }->[$i] =~ s/^[[:blank:]\h]*(?<op>\<|\<=|\>|\>=|=|\!=)[[:blank:]\h]*(?<dt>\-?\d+.*?)$/$+{dt}/ )
3663             $val =~ s/^[[:blank:]\h]*(?<op>\<|\<=|\>|\>=|=|\!=|\~)[[:blank:]\h]*(?<val>.*?)$/$+{val}/ )
3664             {
3665 2         7 $op = $+{op};
3666             }
3667             elsif( defined( $val ) &&
3668             ref( $val ) eq 'Regexp' )
3669             {
3670 0         0 $op = '~';
3671 0         0 $val =~ s/^\(\?[^\:]+\:(.*?)\)$/$1/;
3672             }
3673              
3674 2 50       6 $op = $op_map->{ $op } if( exists( $op_map->{ $op } ) );
3675 2 50       4 if( $op eq '~' )
3676             {
3677 0         0 push( @$and_skels, "$_ REGEXP(?)" );
3678 0         0 push( @$required_keys, "regexp_${_}" );
3679             }
3680             else
3681             {
3682 2         5 push( @$and_skels, "$_ ${op} ?" );
3683 2         4 push( @$required_keys, "${op}${_}" );
3684             }
3685 2 50 33     9 push( @$required_val, defined( $val ) ? ( Scalar::Util::blessed( $val ) && overload::Method( $val => '""' ) ) ? "$val" : $val : $val );
    50          
3686             }
3687 1         5 push( @$required_skel, '( ' . join( ' OR ', @$and_skels ) . ' )' );
3688             }
3689             else
3690             {
3691 148         232 my $op = '=';
3692 148         240 my $val = $opts->{ $_ };
3693 148 50 66     1171 if( defined( $val ) &&
    50 66        
3694             # $opts->{ $_ } =~ s/^[[:blank:]\h]*(?<op>\<|\<=|\>|\>=|=|\!=\~)[[:blank:]\h]*(?<dt>\-?\d+.*?)$/$+{dt}/ )
3695             $val =~ s/^[[:blank:]\h]*(?<op>\<|\<=|\>|\>=|=|\!=|\~)[[:blank:]\h]*(?<val>.*?)$/$+{val}/ )
3696             {
3697 0         0 $op = $+{op};
3698             }
3699             elsif( defined( $val ) &&
3700             ref( $val ) eq 'Regexp' )
3701             {
3702 0         0 $op = '~';
3703 0         0 $val =~ s/^\(\?[^\:]+\:(.*?)\)$/$1/;
3704             }
3705              
3706 148 50       426 $op = $op_map->{ $op } if( exists( $op_map->{ $op } ) );
3707 148 50       286 if( $op eq '~' )
3708             {
3709 0         0 push( @$required_skel, "$_ REGEXP(?)" );
3710 0         0 push( @$required_keys, "regexp_${_}" );
3711             }
3712             else
3713             {
3714 148         561 push( @$required_skel, "$_ ${op} ?" );
3715 148         505 push( @$required_keys, "${op}${_}" );
3716             }
3717 148 50 33     702 push( @$required_val, defined( $val ) ? ( Scalar::Util::blessed( $val ) && overload::Method( $val => '""' ) ) ? "$val" : $val : $val );
    100          
3718             }
3719             }
3720 570 100       1862 my $requires_key = scalar( @$required_keys ) ? join( '_', @$required_keys ) : '';
3721 570         898 my $field_val = [];
3722 570         944 my $field_skel = [];
3723 570         1040 my $field_keys = [];
3724 570         1265 for( @$id )
3725             {
3726 571         1099 my $op = '=';
3727 571 100 66     3819 if( defined( $_ ) &&
    50 33        
3728             s/^[[:blank:]\h]*(?<op>\<|\<=|\>|\>=|=|\!=|\~)[[:blank:]\h]*(?<val>.*?)$/$+{val}/ )
3729             {
3730 1         4 $op = $+{op};
3731             }
3732             elsif( defined( $_ ) &&
3733             ref( $_ ) eq 'Regexp' )
3734             {
3735 0         0 $op = '~';
3736 0         0 s/^\(\?[^\:]+\:(.*?)\)$/$1/;
3737             }
3738              
3739 571 100       11805 $op = $op_map->{ $op } if( exists( $op_map->{ $op } ) );
3740 571 100       1471 if( $op eq '~' )
3741             {
3742 1         4 push( @$field_skel, "${field} REGEXP(?)" );
3743 1         37 push( @$field_keys, "regexp_field" );
3744             }
3745             else
3746             {
3747 570         1993 push( @$field_skel, "${field} ${op} ?" );
3748 570         1804 push( @$field_keys, "${op}${field}" );
3749             }
3750 571 100 66     4504 push( @$field_val, defined( $_ ) ? ( Scalar::Util::blessed( $_ ) && overload::Method( $_ => '""' ) ) ? "$_" : $_ : $_ );
    50          
3751             }
3752 570 100       54626 my $sth_id = ( $def->{id} ? $def->{id} . '_' : '' ) . join( '_', @$field_keys );
3753 570 100       1841 $sth_id .= '_' . $requires_key if( $requires_key );
3754 570         994 my $sth;
3755 570         1109 local $@;
3756 570 100       2185 unless( $sth = $self->_get_cached_statement( $sth_id ) )
3757             {
3758 65   50     263 my $dbh = $self->_dbh || return( $self->pass_error );
3759             $sth = eval
3760 65   50     170 {
3761             $dbh->prepare( "SELECT * FROM ${table} WHERE (" . join( ' OR ', @$field_skel ) . ') ' . ( scalar( @$required_skel ) ? ' AND ' . join( ' AND ', @$required_skel ) : '' ) . ( $def->{multi} ? ' ORDER BY rowid' : '' ) )
3762             } || return( $self->error( "Unable to prepare SQL query with statement ID ${sth_id} to retrieve a ${what} information: ", ( $@ || $dbh->errstr ) ) );
3763 65         12487 $self->_set_cached_statement( $sth_id => $sth );
3764             }
3765              
3766             eval
3767             {
3768 570 100       208598 $sth->execute( @$field_val, ( scalar( @$required_val ) ? @$required_val : () ) );
3769 570 50 0     1329 } || return( $self->error( "Error executing SQL query '$sth->{Statement}' with statement ID ${sth_id} to retrieve a ${what} information:", ( $@ || $sth->errstr ), " with SQL query: ", $sth->{Statement} ) );
3770 570 100 66     31011 my $ref = ( $def->{multi} || scalar( @$id ) > 1 ) ? $sth->fetchall_arrayref({}) : $sth->fetchrow_hashref;
3771 570         2741 $self->_decode_utf8( $ref ) if( MISSING_AUTO_UTF8_DECODING );
3772 570 100 100     2947 if( $ref && scalar( @$sql_arrays_in ) )
3773             {
3774 473 50       3226 $self->_decode_sql_arrays( $sql_arrays_in, $ref ) if( $self->{decode_sql_arrays} );
3775             }
3776 570 50 66     1975 if( !$ref && want( 'HASH' ) )
3777             {
3778 0         0 return( {} );
3779             }
3780 570         12924 return( $ref );
3781             }
3782              
3783             sub _get_cached_statement
3784             {
3785 942     942   1867 my $self = shift( @_ );
3786 942         2050 my $id = shift( @_ );
3787 942 50 50     3423 die( "No statement ID was provided to get its cached object." ) if( !length( $id // '' ) );
3788 942   33     3414 my $file = $self->datafile || $DB_FILE;
3789 942   100     4278 $STHS->{ $file } //= {};
3790 942 50 66     11791 if( exists( $STHS->{ $file }->{ $id } ) &&
      66        
      33        
3791             defined( $STHS->{ $file }->{ $id } ) &&
3792             Scalar::Util::blessed( $STHS->{ $file }->{ $id } ) &&
3793             $STHS->{ $file }->{ $id }->isa( 'DBI::st' ) )
3794             {
3795 701         3300 return( $STHS->{ $file }->{ $id } );
3796             }
3797 241         966 return;
3798             }
3799              
3800             sub _get_metadata
3801             {
3802 1     1   3 my $self = shift( @_ );
3803 1   50     6 my $prop = shift( @_ ) || die( "No metadata property provided." );
3804 1   50     4 my $dbh = $self->_dbh || return( $self->pass_error );
3805 1         2 my $sth;
3806 1 50       6 unless( $sth = $self->_get_cached_statement( 'cldr_metadata' ) )
3807             {
3808             $sth = eval
3809 1   50     2 {
3810             $dbh->prepare( "SELECT value FROM metainfos WHERE property = ?" )
3811             } || return( $self->error( "Unable to prepare query to get the CLDR built datetime from the SQLite database at ", $self->datafile, ": ", ( $@ || $dbh->errstr ) ) );
3812 1         101 $self->_set_cached_statement( cldr_metadata => $sth );
3813             }
3814              
3815 1         2 local $@;
3816             eval
3817 1 50 0     3 {
3818 1         661 $sth->execute( $prop );
3819             } || return( $self->error( "Unable to execute query to get the CLDR property '${prop}' from the SQLite database at ", $self->datafile, ": ", ( $@ || $sth->errstr ) ) );
3820 1         25 my $ref = $sth->fetchrow_arrayref;
3821 1         3 $self->_decode_utf8( $ref ) if( MISSING_AUTO_UTF8_DECODING );
3822 1 50       5 return( '' ) if( !$ref );
3823 1         19 return( $ref->[0] );
3824             }
3825              
3826             sub _locale_object
3827             {
3828 1316     1316   2694296 my $self = shift( @_ );
3829 1316   50     4456 my $locale = shift( @_ ) ||
3830             return( $self->error( "No locale provided to ensure a Locale::Unicode." ) );
3831 1316 100 66     4036 unless( Scalar::Util::blessed( $locale ) &&
3832             $locale->isa( 'Locale::Unicode' ) )
3833             {
3834 1314   50     5320 $locale = Locale::Unicode->new( $locale ) ||
3835             return( $self->pass_error( Locale::Unicode->error ) );
3836             }
3837 1316         567199 return( $locale );
3838             }
3839             sub _set_cached_statement
3840             {
3841 241     241   575 my $self = shift( @_ );
3842 241         548 my $id = shift( @_ );
3843 241         439 my $sth = shift( @_ );
3844 241 50 50     905 die( "No statement ID was provided to cache its object." ) if( !length( $id // '' ) );
3845 241 50 33     2266 if( !$sth )
    50          
3846             {
3847 0         0 die( "No DBI statement handler was provided to cache with ID '${id}'" );
3848             }
3849             elsif( !Scalar::Util::blessed( $sth ) ||
3850             !$sth->isa( 'DBI::st' ) )
3851             {
3852 0         0 die( "Value provided (", overload::StrVal( $sth ), ") is not a DBI statement object." );
3853             }
3854 241   33     723 my $file = $self->datafile || $DB_FILE;
3855 241   50     832 $STHS->{ $file } //= {};
3856 241         959 $STHS->{ $file }->{ $id } = $sth;
3857 241         537 return( $sth );
3858             }
3859              
3860             sub _set_get_prop
3861             {
3862 1434     1434   2415 my $self = shift( @_ );
3863 1434   50     4289 my $field = shift( @_ ) ||
3864             return( $self->error( "No field was provided." ) );
3865 1434         3102 my( $re, $type, $isa );
3866 1434 100       4164 if( ref( $field ) eq 'HASH' )
3867             {
3868 2         5 my $def = $field;
3869 2   50     14 $field = $def->{field} || die( "No 'field' property was provided in the field dictionary hash reference." );
3870 2 50 33     40 if( exists( $def->{regexp} ) &&
    50 33        
      33        
      33        
3871             defined( $def->{regexp} ) &&
3872             ref( $def->{regexp} ) eq 'Regexp' )
3873             {
3874 0         0 $re = $def->{regexp};
3875             }
3876             elsif( exists( $def->{type} ) &&
3877             defined( $def->{type} ) &&
3878             length( $def->{type} ) )
3879             {
3880 2         4 $type = $def->{type};
3881             }
3882 2 0 33     40 if( exists( $def->{isa} ) &&
      33        
3883             defined( $def->{isa} ) &&
3884             length( $def->{isa} ) )
3885             {
3886 0         0 $isa = $def->{isa};
3887             }
3888             }
3889 1434 100       3321 if( @_ )
3890             {
3891 1         2 my $val = shift( @_ );
3892 1 50 33     9 if( defined( $val ) &&
3893             length( $val ) )
3894             {
3895 1 50 33     88 if( defined( $re ) &&
    50 33        
    50          
3896             $val !~ /^$re$/ )
3897             {
3898 0         0 return( $self->error( "Invalid value provided for \"${field}\": ${val}" ) );
3899             }
3900             elsif( defined( $type ) &&
3901             $type eq 'boolean' )
3902             {
3903 0         0 $val = lc( $val );
3904 0 0       0 if( $val =~ /^(?:yes|no)$/i )
    0          
    0          
3905             {
3906 0         0 $self->{_bool_types}->{ $field } = 'literal';
3907 0 0       0 $val = ( $val eq 'yes' ? $self->true : $self->false );
3908             }
3909             elsif( $val =~ /^(?:true|false)$/i )
3910             {
3911 0         0 $self->{_bool_types}->{ $field } = 'logic';
3912 0 0       0 $val = ( $val eq 'true' ? $self->true : $self->false );
3913             }
3914             elsif( $val =~ /^(?:1|0)$/ )
3915             {
3916 0         0 $self->{_bool_types}->{ $field } = 'logic';
3917 0 0       0 $val = ( $val ? $self->true : $self->false );
3918             }
3919             else
3920             {
3921 0 0       0 warn( "Unexpected value used as boolean for attribute \"${field}\": ${val}" ) if( warnings::enabled() );
3922 0 0       0 $val = ( $val ? $self->true : $self->false );
3923             }
3924             }
3925             elsif( defined( $isa ) )
3926             {
3927 0 0 0     0 if( !Scalar::Util::blessed( $val ) ||
      0        
3928             ( Scalar::Util::blessed( $val ) && !$val->isa( $isa ) ) )
3929             {
3930 0         0 return( $self->error( "Value provided is not an ${isa} object." ) );
3931             }
3932             }
3933             }
3934 1         9 $self->{ $field } = $val
3935             }
3936             # So chaining works
3937 1434 50       4943 rreturn( $self ) if( want( 'OBJECT' ) );
3938             # Returns undef in scalar context and an empty list in list context
3939 1434 50       128692 return if( !defined( $self->{ $field } ) );
3940 1434         6899 return( $self->{ $field } );
3941             }
3942              
3943             sub _get_args_as_hash
3944             {
3945 1181     1181   2276 my $self = shift( @_ );
3946 1181         2141 my $ref = {};
3947 1181 50 33     7438 if( scalar( @_ ) == 1 &&
    50 0        
      33        
3948             defined( $_[0] ) &&
3949             ( ref( $_[0] ) || '' ) eq 'HASH' )
3950             {
3951 0         0 $ref = shift( @_ );
3952             }
3953             elsif( !( scalar( @_ ) % 2 ) )
3954             {
3955 1181         4510 $ref = { @_ };
3956             }
3957             else
3958             {
3959 0         0 die( "Uneven number of parameters provided." );
3960             }
3961 1181         3056 return( $ref );
3962             }
3963              
3964             # NOTE: END
3965             END
3966             {
3967 5 50 33 5   262582 if( defined( $STHS ) && ref( $STHS ) eq 'HASH' )
3968             {
3969 5         30 foreach my $db ( keys( %$STHS ) )
3970             {
3971 3         8 foreach my $sth ( keys( %{$STHS->{ $db }} ) )
  3         215  
3972             {
3973 241 50 33     705 if( defined( $sth ) &&
3974             Scalar::Util::blessed( $sth ) )
3975             {
3976 0         0 $sth->finish;
3977             }
3978             }
3979             }
3980             }
3981             };
3982              
3983             sub FREEZE
3984             {
3985 0     0 0 0 my $self = CORE::shift( @_ );
3986 0   0     0 my $serialiser = CORE::shift( @_ ) // '';
3987 0         0 my $class = CORE::ref( $self );
3988 0         0 my @keys = qw( datafile decode_sql_arrays fatal );
3989 0         0 my %hash = ();
3990 0         0 @hash{ @keys } = @$self{ @keys };
3991             # Return an array reference rather than a list so this works with Sereal and CBOR
3992             # On or before Sereal version 4.023, Sereal did not support multiple values returned
3993 0 0 0     0 CORE::return( [$class, %hash] ) if( $serialiser eq 'Sereal' && Sereal::Encoder->VERSION <= version->parse( '4.023' ) );
3994             # But Storable want a list with the first element being the serialised element
3995 0         0 CORE::return( $class, \%hash );
3996             }
3997              
3998 0     0 0 0 sub STORABLE_freeze { return( shift->FREEZE( @_ ) ); }
3999              
4000 0     0 0 0 sub STORABLE_thaw { return( shift->THAW( @_ ) ); }
4001              
4002             # NOTE: CBOR will call the THAW method with the stored classname as first argument, the constant string CBOR as second argument, and all values returned by FREEZE as remaining arguments.
4003             # NOTE: Storable calls it with a blessed object it created followed with $cloning and any other arguments initially provided by STORABLE_freeze
4004             sub THAW
4005             {
4006 0     0 0 0 my( $self, undef, @args ) = @_;
4007 0 0 0     0 my $ref = ( CORE::scalar( @args ) == 1 && CORE::ref( $args[0] ) eq 'ARRAY' ) ? CORE::shift( @args ) : \@args;
4008 0 0 0     0 my $class = ( CORE::defined( $ref ) && CORE::ref( $ref ) eq 'ARRAY' && CORE::scalar( @$ref ) > 1 ) ? CORE::shift( @$ref ) : ( CORE::ref( $self ) || $self );
      0        
4009 0 0       0 my $hash = CORE::ref( $ref ) eq 'ARRAY' ? CORE::shift( @$ref ) : {};
4010 0         0 my $new;
4011             # Storable pattern requires to modify the object it created rather than returning a new one
4012 0 0       0 if( CORE::ref( $self ) )
4013             {
4014 0         0 foreach( CORE::keys( %$hash ) )
4015             {
4016 0         0 $self->{ $_ } = CORE::delete( $hash->{ $_ } );
4017             }
4018 0         0 $new = $self;
4019             }
4020             else
4021             {
4022 0         0 $new = CORE::bless( $hash => $class );
4023             }
4024 0         0 CORE::return( $new );
4025             }
4026              
4027             sub TO_JSON
4028             {
4029 0     0 0 0 my $self = CORE::shift( @_ );
4030 0         0 my @keys = qw( datafile decode_sql_arrays );
4031 0         0 my $hash = {};
4032 0         0 @$hash{ @keys } = @$self{ @keys };
4033 0         0 return( $hash );
4034             }
4035              
4036             # NOTE: Locale::Unicode::Data::Boolean class
4037             package Locale::Unicode::Data::Boolean;
4038             BEGIN
4039             {
4040 5     5   66 use strict;
  5         20  
  5         228  
4041 5     5   31 use warnings;
  5         18  
  5         479  
4042 5     5   33 use vars qw( $VERSION $true $false );
  5         10  
  5         1172  
4043             use overload
4044 0     0   0 "0+" => sub{ ${$_[0]} },
  0         0  
4045 0     0   0 "++" => sub{ $_[0] = ${$_[0]} + 1 },
  0         0  
4046 0     0   0 "--" => sub{ $_[0] = ${$_[0]} - 1 },
  0         0  
4047 5     5   41 fallback => 1;
  5         9  
  5         87  
4048 5     5   1064 $true = do{ bless( \( my $dummy = 1 ) => 'Locale::Unicode::Data::Boolean' ) };
  5         50  
4049 5         11 $false = do{ bless( \( my $dummy = 0 ) => 'Locale::Unicode::Data::Boolean' ) };
  5         13  
4050 5         150 our $VERSION = 'v0.1.0';
4051             };
4052 5     5   40 use strict;
  5         25  
  5         218  
4053 5     5   29 use warnings;
  5         54  
  5         4186  
4054              
4055             sub new
4056             {
4057 0     0   0 my $this = shift( @_ );
4058 0 0 0     0 my $self = bless( \( my $dummy = ( $_[0] ? 1 : 0 ) ) => ( ref( $this ) || $this ) );
4059             }
4060              
4061             sub clone
4062             {
4063 0     0   0 my $self = shift( @_ );
4064 0 0       0 unless( ref( $self ) )
4065             {
4066 0         0 die( "clone() must be called with an object." );
4067             }
4068 0         0 my $copy = $$self;
4069 0         0 my $new = bless( \$copy => ref( $self ) );
4070 0         0 return( $new );
4071             }
4072              
4073 0     0   0 sub false() { $false }
4074              
4075 0     0   0 sub is_bool($) { UNIVERSAL::isa( $_[0], 'Locale::Unicode::Data::Boolean' ) }
4076              
4077 0 0   0   0 sub is_true($) { $_[0] && UNIVERSAL::isa( $_[0], 'Locale::Unicode::Data::Boolean' ) }
4078              
4079 0 0   0   0 sub is_false($) { !$_[0] && UNIVERSAL::isa( $_[0], 'Locale::Unicode::Data::Boolean' ) }
4080              
4081 0     0   0 sub true() { $true }
4082              
4083             sub FREEZE
4084             {
4085 0     0   0 my $self = CORE::shift( @_ );
4086 0   0     0 my $serialiser = CORE::shift( @_ ) // '';
4087 0         0 my $class = CORE::ref( $self );
4088             # Return an array reference rather than a list so this works with Sereal and CBOR
4089             # On or before Sereal version 4.023, Sereal did not support multiple values returned
4090 0 0 0     0 CORE::return( [$class, $$self] ) if( $serialiser eq 'Sereal' && Sereal::Encoder->VERSION <= version->parse( '4.023' ) );
4091             # But Storable want a list with the first element being the serialised element
4092 0         0 CORE::return( $$self );
4093             }
4094              
4095 0     0   0 sub STORABLE_freeze { CORE::return( CORE::shift->FREEZE( @_ ) ); }
4096              
4097 0     0   0 sub STORABLE_thaw { CORE::return( CORE::shift->THAW( @_ ) ); }
4098              
4099             # NOTE: CBOR will call the THAW method with the stored classname as first argument, the constant string CBOR as second argument, and all values returned by FREEZE as remaining arguments.
4100             # NOTE: Storable calls it with a blessed object it created followed with $cloning and any other arguments initially provided by STORABLE_freeze
4101             sub THAW
4102             {
4103 0     0   0 my( $self, undef, @args ) = @_;
4104 0         0 my( $class, $str );
4105 0 0 0     0 if( CORE::scalar( @args ) == 1 && CORE::ref( $args[0] ) eq 'ARRAY' )
4106             {
4107 0         0 ( $class, $str ) = @{$args[0]};
  0         0  
4108             }
4109             else
4110             {
4111 0   0     0 $class = CORE::ref( $self ) || $self;
4112 0         0 $str = CORE::shift( @args );
4113             }
4114             # Storable pattern requires to modify the object it created rather than returning a new one
4115 0 0       0 if( CORE::ref( $self ) )
4116             {
4117 0         0 $$self = $str;
4118 0         0 CORE::return( $self );
4119             }
4120             else
4121             {
4122 0         0 CORE::return( $class->new( $str ) );
4123             }
4124             }
4125              
4126             sub TO_JSON
4127             {
4128             # JSON does not check that the value is a proper true or false. It stupidly assumes this is a string
4129             # The only way to make it understand is to return a scalar ref of 1 or 0
4130             # return( $_[0] ? 'true' : 'false' );
4131 0 0   0   0 return( $_[0] ? \1 : \0 );
4132             }
4133              
4134             # NOTE: Locale::Unicode::Data::Exception class
4135             package Locale::Unicode::Data::Exception;
4136             BEGIN
4137             {
4138 5     5   96 use strict;
  5         36  
  5         183  
4139 5     5   27 use warnings;
  5         6  
  5         305  
4140 5     5   43 use vars qw( $VERSION );
  5         23  
  5         429  
4141             use overload (
4142             '""' => 'as_string',
4143 1     1   602 bool => sub{ $_[0] },
4144 5         50 fallback => 1,
4145 5     5   32 );
  5         16  
4146 5     5   796 our $VERSION = 'v0.1.0';
4147             };
4148 5     5   48 use strict;
  5         8  
  5         151  
4149 5     5   22 use warnings;
  5         9  
  5         420  
4150 5     5   38 use overloading;
  5         21  
  5         3000  
4151              
4152             sub new
4153             {
4154 1     1   1 my $this = shift( @_ );
4155 1   33     5 my $self = bless( {} => ( ref( $this ) || $this ) );
4156 1         3 my @info = caller;
4157 1         28 @$self{ qw( package file line ) } = @info[0..2];
4158 1         1 my $args = {};
4159 1 50       13 if( scalar( @_ ) == 1 )
4160             {
4161 1 50 50     4 if( ( ref( $_[0] ) || '' ) eq 'HASH' )
    0 0        
4162             {
4163 1         2 $args = shift( @_ );
4164 1 50       3 if( $args->{skip_frames} )
4165             {
4166 1         6 @info = caller( int( $args->{skip_frames} ) );
4167 1         3 @$self{ qw( package file line ) } = @info[0..2];
4168             }
4169 1   50     3 $args->{message} ||= '';
4170 1         3 foreach my $k ( qw( package file line message code type retry_after ) )
4171             {
4172 7 100       10 $self->{ $k } = $args->{ $k } if( CORE::exists( $args->{ $k } ) );
4173             }
4174             }
4175             elsif( ref( $_[0] ) && $_[0]->isa( 'Locale::Unicode::Data::Exception' ) )
4176             {
4177 0         0 my $o = $args->{object} = shift( @_ );
4178 0         0 $self->{message} = $o->message;
4179 0         0 $self->{code} = $o->code;
4180 0         0 $self->{type} = $o->type;
4181 0         0 $self->{retry_after} = $o->retry_after;
4182             }
4183             else
4184             {
4185 0         0 die( "Unknown argument provided: '", overload::StrVal( $_[0] ), "'" );
4186             }
4187             }
4188             else
4189             {
4190 0 0       0 $args->{message} = join( '', map( ref( $_ ) eq 'CODE' ? $_->() : $_, @_ ) );
4191             }
4192 1         5 return( $self );
4193             }
4194              
4195             # This is important as stringification is called by die, so as per the manual page, we need to end with new line
4196             # And will add the stack trace
4197             sub as_string
4198             {
4199 5     5   38 no overloading;
  5         9  
  5         7722  
4200 0     0     my $self = shift( @_ );
4201 0 0 0       return( $self->{_cache_value} ) if( $self->{_cache_value} && !CORE::length( $self->{_reset} ) );
4202 0           my $str = $self->message;
4203 0           $str = "$str";
4204 0           $str =~ s/\r?\n$//g;
4205 0   0       $str .= sprintf( " within package %s at line %d in file %s", ( $self->{package} // 'undef' ), ( $self->{line} // 'undef' ), ( $self->{file} // 'undef' ) );
      0        
      0        
4206 0           $self->{_cache_value} = $str;
4207 0           CORE::delete( $self->{_reset} );
4208 0           return( $str );
4209             }
4210              
4211 0     0     sub code { return( shift->reset(@_)->_set_get_prop( 'code', @_ ) ); }
4212              
4213 0     0     sub file { return( shift->reset(@_)->_set_get_prop( 'file', @_ ) ); }
4214              
4215 0     0     sub line { return( shift->reset(@_)->_set_get_prop( 'line', @_ ) ); }
4216              
4217 0     0     sub message { return( shift->reset(@_)->_set_get_prop( 'message', @_ ) ); }
4218              
4219 0     0     sub package { return( shift->reset(@_)->_set_get_prop( 'package', @_ ) ); }
4220              
4221             # From perlfunc docmentation on "die":
4222             # "If LIST was empty or made an empty string, and $@ contains an
4223             # object reference that has a "PROPAGATE" method, that method will
4224             # be called with additional file and line number parameters. The
4225             # return value replaces the value in $@; i.e., as if "$@ = eval {
4226             # $@->PROPAGATE(__FILE__, __LINE__) };" were called."
4227             sub PROPAGATE
4228             {
4229 0     0     my( $self, $file, $line ) = @_;
4230 0 0 0       if( defined( $file ) && defined( $line ) )
4231             {
4232 0           my $clone = $self->clone;
4233 0           $clone->file( $file );
4234 0           $clone->line( $line );
4235 0           return( $clone );
4236             }
4237 0           return( $self );
4238             }
4239              
4240             sub reset
4241             {
4242 0     0     my $self = shift( @_ );
4243 0 0 0       if( !CORE::length( $self->{_reset} ) && scalar( @_ ) )
4244             {
4245 0           $self->{_reset} = scalar( @_ );
4246             }
4247 0           return( $self );
4248             }
4249              
4250             sub rethrow
4251             {
4252 0     0     my $self = shift( @_ );
4253 0 0         return if( !ref( $self ) );
4254 0           die( $self );
4255             }
4256              
4257 0     0     sub retry_after { return( shift->_set_get_prop( 'retry_after', @_ ) ); }
4258              
4259             sub throw
4260             {
4261 0     0     my $self = shift( @_ );
4262 0           my $e;
4263 0 0         if( @_ )
4264             {
4265 0           my $msg = shift( @_ );
4266 0           $e = $self->new({
4267             skip_frames => 1,
4268             message => $msg,
4269             });
4270             }
4271             else
4272             {
4273 0           $e = $self;
4274             }
4275 0           die( $e );
4276             }
4277              
4278 0     0     sub type { return( shift->reset(@_)->_set_get_prop( 'type', @_ ) ); }
4279              
4280             sub _set_get_prop
4281             {
4282 0     0     my $self = shift( @_ );
4283 0   0       my $prop = shift( @_ ) || die( "No object property was provided." );
4284 0 0         $self->{ $prop } = shift( @_ ) if( @_ );
4285 0           return( $self->{ $prop } );
4286             }
4287              
4288             sub FREEZE
4289             {
4290 0     0     my $self = CORE::shift( @_ );
4291 0   0       my $serialiser = CORE::shift( @_ ) // '';
4292 0           my $class = CORE::ref( $self );
4293 0           my %hash = %$self;
4294             # Return an array reference rather than a list so this works with Sereal and CBOR
4295             # On or before Sereal version 4.023, Sereal did not support multiple values returned
4296 0 0 0       CORE::return( [$class, \%hash] ) if( $serialiser eq 'Sereal' && Sereal::Encoder->VERSION <= version->parse( '4.023' ) );
4297             # But Storable want a list with the first element being the serialised element
4298 0           CORE::return( $class, \%hash );
4299             }
4300              
4301 0     0     sub STORABLE_freeze { return( shift->FREEZE( @_ ) ); }
4302              
4303 0     0     sub STORABLE_thaw { return( shift->THAW( @_ ) ); }
4304              
4305             # NOTE: CBOR will call the THAW method with the stored classname as first argument, the constant string CBOR as second argument, and all values returned by FREEZE as remaining arguments.
4306             # NOTE: Storable calls it with a blessed object it created followed with $cloning and any other arguments initially provided by STORABLE_freeze
4307             sub THAW
4308             {
4309 0     0     my( $self, undef, @args ) = @_;
4310 0 0 0       my $ref = ( CORE::scalar( @args ) == 1 && CORE::ref( $args[0] ) eq 'ARRAY' ) ? CORE::shift( @args ) : \@args;
4311 0 0 0       my $class = ( CORE::defined( $ref ) && CORE::ref( $ref ) eq 'ARRAY' && CORE::scalar( @$ref ) > 1 ) ? CORE::shift( @$ref ) : ( CORE::ref( $self ) || $self );
      0        
4312 0 0         my $hash = CORE::ref( $ref ) eq 'ARRAY' ? CORE::shift( @$ref ) : {};
4313 0           my $new;
4314             # Storable pattern requires to modify the object it created rather than returning a new one
4315 0 0         if( CORE::ref( $self ) )
4316             {
4317 0           foreach( CORE::keys( %$hash ) )
4318             {
4319 0           $self->{ $_ } = CORE::delete( $hash->{ $_ } );
4320             }
4321 0           $new = $self;
4322             }
4323             else
4324             {
4325 0           $new = CORE::bless( $hash => $class );
4326             }
4327 0           CORE::return( $new );
4328             }
4329              
4330 0     0     sub TO_JSON { return( shift->as_string ); }
4331              
4332             {
4333             # NOTE: Locale::Unicode::Data::NullObject class
4334             package
4335             Locale::Unicode::Data::NullObject;
4336             BEGIN
4337 0         0 {
4338 5     5   45 use strict;
  5         10  
  5         167  
4339 5     5   26 use warnings;
  5         8  
  5         454  
4340             use overload (
4341 0     0   0 '""' => sub{ '' },
4342 5         54 fallback => 1,
4343 5     5   42 );
  5         25  
4344 5     5   480 use Wanted;
  5     0   10  
  5         653  
4345             };
4346 5     5   34 use strict;
  5         9  
  5         148  
4347 5     5   25 use warnings;
  5         7  
  5         1951  
4348              
4349             sub new
4350             {
4351 0     0     my $this = shift( @_ );
4352 0 0         my $ref = @_ ? { @_ } : {};
4353 0   0       return( bless( $ref => ( ref( $this ) || $this ) ) );
4354             }
4355              
4356             sub AUTOLOAD
4357             {
4358 0     0     my( $method ) = our $AUTOLOAD =~ /([^:]+)$/;
4359 0           my $self = shift( @_ );
4360 0 0         if( want( 'OBJECT' ) )
4361             {
4362 0           rreturn( $self );
4363             }
4364             # Otherwise, we return undef; Empty return returns undef in scalar context and empty list in list context
4365 0           return;
4366             };
4367             }
4368              
4369             1;
4370             # NOTE: POD
4371             __END__
4372              
4373             =encoding utf-8
4374              
4375             =head1 NAME
4376              
4377             Locale::Unicode::Data - Unicode CLDR SQL Data
4378              
4379             =head1 SYNOPSIS
4380              
4381             use Locale::Unicode::Data;
4382             my $cldr = Locale::Unicode::Data->new;
4383             # Do not decode SQL arrays into perl arrays. Defaults to true
4384             # This uses JSON::XS
4385             my $cldr = Locale::Unicode::Data->new( decode_sql_arrays => 0 );
4386             my $datetime = $cldr->cldr_built;
4387             my $str = $cldr->cldr_maintainer;
4388             my $version = $cldr->cldr_version;
4389             my $dbh = $cldr->database_handler;
4390             my $sqlite_db_file = $cldr->datafile;
4391             my $bool = $cldr->decode_sql_arrays;
4392             # Deactivate automatic SQL arrays decoding
4393             $cldr->decode_sql_arrays(0);
4394             my $tree = $cldr->make_inheritance_tree( 'ja-JP' );
4395             # ['ja-JP', 'ja', 'und']
4396             my $tree = $cldr->make_inheritance_tree( 'es-Latn-001-valencia' );
4397             # ['es-Latn-001-valencia', 'es-Latn-001', 'es-Latn', 'es', 'und']
4398             # But...
4399             my $tree = $cldr->make_inheritance_tree( 'pt-FR' );
4400             # Because exceptionally, the parent of 'pt-FR' is not 'pt', but 'pt-PT'
4401             # ['pt-FR', 'pt-PT', 'pt', 'und']
4402             my $ref = $cldr->split_interval(
4403             pattern => "E, MMM d, y – E, MMM d, y G",
4404             greatest_diff => 'y',
4405             );
4406             # ["E, MMM d, y", " – ", "E, MMM d, y G", "E, MMM d, y"]
4407              
4408             my $ref = $cldr->alias(
4409             alias => 'fro',
4410             type => 'subdivision',
4411             ); # For 'Hauts-de-France'
4412             my $all = $cldr->aliases;
4413             # 'type' can be one of territory, language, zone, subdivision, variant, script
4414             my $all = $cldr->aliases( type => 'territory' );
4415             my $ref = $cldr->annotation( annotation => '{', locale => 'en' );
4416             my $all = $cldr->annotations;
4417             # Get all annotations for locale 'en'
4418             my $all = $cldr->annotations( locale => 'en' );
4419             my $ref = $cldr->bcp47_currency( currid => 'jpy' );
4420             my $all = $cldr->bcp47_currencies;
4421             my $all = $cldr->bcp47_currencies( code => 'JPY' );
4422             # Get all obsolete BCP47 currencies
4423             my $all = $cldr->bcp47_currencies( is_obsolete => 1 );
4424             my $ref = $cldr->bcp47_extension( extension => 'ca' );
4425             my $all = $cldr->bcp47_extensions;
4426             # Get all deprecated BCP47 extensions
4427             my $all = $cldr->bcp47_extensions( deprecated => 1 );
4428             my $ref = $cldr->bcp47_timezone( tzid => 'jptyo' );
4429             my $all = $cldr->bcp47_timezones;
4430             # Get all deprecated BCP47 timezones
4431             my $all = $cldr->bcp47_timezones( deprecated => 1 );
4432             # Returns information about Japanese Imperial calendar
4433             my $ref = $cldr->bcp47_value( value => 'japanese' );
4434             my $all = $cldr->bcp47_timezones;
4435             # Get all the BCP47 values for the category 'calendar'
4436             my $all = $cldr->bcp47_values( category => 'calendar' );
4437             my $all = $cldr->bcp47_values( extension => 'ca' );
4438             my $ref = $cldr->calendar( calendar => 'gregorian' );
4439             my $all = $cldr->calendars;
4440             # Known 'system' value: undef, lunar, lunisolar, other, solar
4441             my $all = $cldr->calendars( system => 'solar' );
4442             my $ref = $cldr->calendar_append_format(
4443             locale => 'en',
4444             calendar => 'gregorian',
4445             format_id => 'Day',
4446             );
4447             my $all = $cldr->calendar_append_formats;
4448             my $all = $cldr->calendar_append_formats(
4449             locale => 'en',
4450             calendar => 'gregorian',
4451             );
4452             my $ref = $cldr->calendar_available_format(
4453             locale => 'en',
4454             calendar => 'gregorian',
4455             format_id => 'Hms',
4456             count => undef,
4457             alt => undef,
4458             );
4459             my $all = $cldr->calendar_available_formats;
4460             my $all = $cldr->calendar_available_formats( locale => 'en', calendar => 'gregorian' );
4461             my $ref = $cldr->calendar_cyclic_l10n(
4462             locale => 'und',
4463             calendar => 'chinese',
4464             format_set => 'dayParts',
4465             format_type => 'format',
4466             format_length => 'abbreviated',
4467             format_id => 1,
4468             );
4469             my $all = $cldr->calendar_cyclics_l10n;
4470             my $all = $cldr->calendar_cyclics_l10n( locale => 'en' );
4471             my $all = $cldr->calendar_cyclics_l10n(
4472             locale => 'en',
4473             calendar => 'chinese',
4474             format_set => 'dayParts',
4475             # Not really needed since 'format' is the only value being currently used
4476             # format_type => 'format',
4477             format_length => 'abbreviated',
4478             );
4479             my $all = $cldr->calendar_datetime_formats;
4480             my $all = $cldr->calendar_datetime_formats(
4481             locale => 'en',
4482             calendar => 'gregorian',
4483             );
4484             my $ref = $cldr->calendar_era(
4485             calendar => 'japanese',
4486             sequence => 236,
4487             ); # Current era 'reiwa'
4488             my $ref = $cldr->calendar_era(
4489             calendar => 'japanese',
4490             code => 'reiwa',
4491             ); # Current era 'reiwa'
4492             my $all = $cldr->calendar_eras;
4493             my $all = $cldr->calendar_eras( calendar => 'hebrew' );
4494             my $ref = $cldr->calendar_format_l10n(
4495             locale => 'en',
4496             calendar => 'gregorian',
4497             format_type => 'date',
4498             format_length => 'full',
4499             format_id => 'yMEEEEd',
4500             );
4501             my $ref = $cldr->calendar_era_l10n(
4502             locale => 'ja',
4503             calendar => 'gregorian',
4504             era_width => 'abbreviated',
4505             alt => undef,
4506             era_id => 0,
4507             );
4508             my $array_ref = $cldr->calendar_eras_l10n;
4509             # Filter based on the 'locale' field value
4510             my $array_ref = $cldr->calendar_eras_l10n( locale => 'en' );
4511             # Filter based on the 'calendar' field value
4512             my $array_ref = $cldr->calendar_eras_l10n( calendar => 'gregorian' );
4513             # or a combination of multiple fields:
4514             my $array_ref = $cldr->calendar_eras_l10n(
4515             locale => 'en',
4516             calendar => 'gregorian',
4517             era_width => 'abbreviated',
4518             alt => undef
4519             );
4520             my $ref = $cldr->calendar_format_l10n(
4521             locale => 'en',
4522             calendar => 'gregorian',
4523             # date, time
4524             format_type => 'date',
4525             # full, long, medium, short
4526             format_length => 'full',
4527             format_id => 'yMEEEEd',
4528             );
4529             my $all = $cldr->calendar_formats_l10n;
4530             my $all = $cldr->calendar_formats_l10n(
4531             locale => 'en',
4532             calendar => 'gregorian',
4533             );
4534             my $all = $cldr->calendar_formats_l10n(
4535             locale => 'en',
4536             calendar => 'gregorian',
4537             format_type => 'date',
4538             format_length => 'full',
4539             );
4540             my $ref = $cldr->calendar_interval_format(
4541             locale => 'en',
4542             calendar => 'gregorian',
4543             greatest_diff_id => 'd',
4544             format_id => 'GyMMMEd',
4545             alt => undef,
4546             );
4547             my $all = $cldr->calendar_interval_formats;
4548             my $all = $cldr->calendar_interval_formats(
4549             locale => 'en',
4550             calendar => 'gregorian',
4551             );
4552             my $ref = $cldr->calendar_term(
4553             locale => 'und',
4554             calendar => 'gregorian',
4555             # format, stand-alone
4556             term_context => 'format',
4557             # abbreviated, narrow, wide
4558             term_width => 'abbreviated',
4559             term_name => 'am',
4560             );
4561             my $array_ref = $cldr->calendar_terms;
4562             my $array_ref = $cldr->calendar_terms(
4563             locale => 'und',
4564             calendar => 'japanese'
4565             );
4566             my $array_ref = $cldr->calendar_terms(
4567             locale => 'und',
4568             calendar => 'gregorian',
4569             term_type => 'day',
4570             term_context => 'format',
4571             term_width => 'abbreviated',
4572             );
4573             my $ref = $cldr->casing( locale => 'fr', token => 'currencyName' );
4574             my $all = $cldr->casings;
4575             my $all = $cldr->casings( locale => 'fr' );
4576             my $ref = $cldr->code_mapping( code => 'US' );
4577             my $all = $cldr->code_mappings;
4578             my $all = $cldr->code_mappings( type => 'territory' );
4579             my $all = $cldr->code_mappings( type => 'currency' );
4580             my $all = $cldr->code_mappings( alpha3 => 'USA' );
4581             my $all = $cldr->code_mappings( numeric => 840 ); # U.S.A.
4582             my $all = $cldr->code_mappings( numeric => [">835", "<850"] ); # U.S.A.
4583             my $all = $cldr->code_mappings( fips => 'JP' ); # Japan
4584             my $all = $cldr->code_mappings( fips => undef, type => 'currency' );
4585             my $ref = $cldr->collation( collation => 'ducet' );
4586             my $all = $cldr->collations;
4587             my $all = $cldr->collations( description => qr/Chinese/ );
4588             my $ref = $cldr->collation_l10n( locale => 'en', collation => 'ducet' );
4589             my $all = $cldr->collations_l10n( locale => 'en' );
4590             my $all = $cldr->collations_l10n( locale => 'ja', locale_name => qr/中国語/ );
4591             my $ref = $cldr->currency( currency => 'JPY' ); # Japanese Yen
4592             my $all = $cldr->currencies;
4593             my $all = $cldr->currencies( is_obsolete => 1 );
4594             my $ref = $cldr->currency_info( territory => 'FR', currency => 'EUR' );
4595             my $all = $cldr->currencies_info;
4596             my $all = $cldr->currencies_info( territory => 'FR' );
4597             my $all = $cldr->currencies_info( currency => 'EUR' );
4598             my $ref = $cldr->currency_l10n(
4599             locale => 'en',
4600             count => undef,
4601             currency => 'JPY',
4602             );
4603             my $all = $cldr->currencies_l10n;
4604             my $all = $cldr->currencies_l10n( locale => 'en' );
4605             my $all = $cldr->currencies_l10n(
4606             locale => 'en',
4607             currency => 'JPY',
4608             );
4609             my $ref = $cldr->date_field_l10n(
4610             locale => 'en',
4611             field_type => 'day',
4612             field_length => 'narrow',
4613             relative => -1,
4614             );
4615             my $all = $cldr->date_fields_l10n;
4616             my $all = $cldr->date_fields_l10n( locale => 'en' );
4617             my $all = $cldr->date_fields_l10n(
4618             locale => 'en',
4619             field_type => 'day',
4620             field_length => 'narrow',
4621             );
4622             my $ref = $cldr->day_period( locale => 'fr', day_period => 'noon' );
4623             my $all = $cldr->day_periods;
4624             my $all = $cldr->day_periods( locale => 'ja' );
4625             # Known values for day_period: afternoon1, afternoon2, am, evening1, evening2,
4626             # midnight, morning1, morning2, night1, night2, noon, pm
4627             my $all = $cldr->day_periods( day_period => 'noon' );
4628             my $ids = $cldr->interval_formats(
4629             locale => 'en',
4630             calendar => 'gregorian',
4631             );
4632             # Retrieve localised information for certain type of data
4633             # Possible types are: annotation, calendar_append_format, calendar_available_format,
4634             # calendar_cyclic, calendar_era, calendar_format, calendar_interval_formats,
4635             # calendar_term, casing, currency, date_field, locale, number_format, number_symbol
4636             # script, subdivision, territory, unit, variant
4637             my $ref = $cldr->l10n(
4638             type => 'annotation',
4639             locale => 'en',
4640             annotation => '{',
4641             );
4642             my $ref = $cldr->l10n(
4643             # or just 'append'
4644             type => 'calendar_append_format',
4645             locale => 'en',
4646             calendar => 'gregorian',
4647             format_id => 'Day',
4648             );
4649             my $ref = $cldr->l10n(
4650             # or just 'available'
4651             type => 'calendar_available_format',
4652             locale => 'ja',
4653             calendar => 'japanese',
4654             format_id => 'GyMMMEEEEd',
4655             );
4656             my $ref = $cldr->l10n(
4657             # or just 'cyclic'
4658             type => 'calendar_cyclic',
4659             locale => 'ja',
4660             calendar => 'chinese',
4661             format_set => 'dayParts',
4662             # 1..12
4663             format_id => 1,
4664             );
4665             # Retrieve the information on current Japanese era (Reiwa)
4666             my $ref = $cldr->l10n(
4667             # or just 'era'
4668             type => 'calendar_era',
4669             locale => 'ja',
4670             calendar => 'japanese',
4671             # abbreviated, narrow
4672             # 'narrow' contains less data than 'abbreviated'
4673             era_width => 'abbreviated',
4674             era_id => 236,
4675             );
4676             my $ref = $cldr->l10n(
4677             type => 'calendar_format',
4678             locale => 'ja',
4679             calendar => 'gregorian',
4680             format_id => 'yMEEEEd',
4681             );
4682             my $ref = $cldr->l10n(
4683             # or just 'interval'
4684             type => 'calendar_interval_format',
4685             locale => 'ja',
4686             calendar => 'gregorian',
4687             format_id => 'yMMM',
4688             );
4689             my $ref = $cldr->l10n(
4690             type => 'calendar_term',
4691             locale => 'ja',
4692             calendar => 'gregorian',
4693             term_name => 'mon',
4694             );
4695             my $ref = $cldr->l10n(
4696             type => 'casing',
4697             locale => 'fr',
4698             token => 'currencyName',
4699             );
4700             my $ref = $cldr->l10n(
4701             type => 'currency',
4702             locale => 'ja',
4703             currency => 'EUR',
4704             );
4705             my $ref = $cldr->l10n(
4706             # or just 'field'
4707             type => 'date_field',
4708             locale => 'ja',
4709             # Other possible values:
4710             # day, week, month, quarter, year, hour, minute, second,
4711             # mon, tue, wed, thu, fri, sat, sun
4712             field_type => 'day',
4713             # -1 for yesterday, 0 for today, 1 for tomorrow
4714             relative => -1,
4715             );
4716             my $ref = $cldr->l10n(
4717             type => 'locale',
4718             locale => 'ja',
4719             locale_id => 'fr',
4720             );
4721             my $ref = $cldr->l10n(
4722             type => 'number_format',
4723             locale => 'ja',
4724             number_type => 'currency',
4725             format_id => '10000',
4726             );
4727             my $ref = $cldr->l10n(
4728             # or just 'symbol'
4729             type => 'number_symbol',
4730             locale => 'en',
4731             number_system => 'latn',
4732             property => 'decimal',
4733             );
4734             my $ref = $cldr->l10n(
4735             type => 'script',
4736             locale => 'ja',
4737             script => 'Kore',
4738             );
4739             my $ref = $cldr->l10n(
4740             type => 'subdivision',
4741             locale => 'en',
4742             subdivision => 'jp13', # Tokyo
4743             );
4744             my $ref = $cldr->l10n(
4745             type => 'territory',
4746             locale => 'en',
4747             territory => 'JP', # Japan
4748             );
4749             my $ref = $cldr->l10n(
4750             type => 'unit',
4751             locale => 'en',
4752             unit_id => 'power3',
4753             );
4754             my $ref = $cldr->l10n(
4755             type => 'variant',
4756             locale => 'en',
4757             variant => 'valencia',
4758             );
4759             my $ref = $cldr->language( language => 'ryu' ); # Central Okinawan (Ryukyu)
4760             my $all = $cldr->languages;
4761             my $all = $cldr->languages( parent => 'gmw' );
4762             my $all = $cldr->language_population( territory => 'JP' );
4763             my $all = $cldr->language_populations;
4764             my $all = $cldr->language_populations( official_status => 'official' );
4765             my $ref = $cldr->likely_subtag( locale => 'ja' );
4766             my $all = $cldr->likely_subtags;
4767             my $ref = $cldr->locale( locale => 'ja' );
4768             my $all = $cldr->locales;
4769             my $ref = $cldr->locale_l10n(
4770             locale => 'en',
4771             locale_id => 'ja',
4772             alt => undef,
4773             );
4774             my $all = $cldr->locales_l10n;
4775             # Returns an array reference of all locale information in English
4776             my $all = $cldr->locales_l10n( locale => 'en' );
4777             # Returns an array reference of all the way to write 'Japanese' in various languages
4778             # This would typically return an array reference of something like 267 hash reference
4779             my $all = $cldr->locales_l10n( locale_id => 'ja' );
4780             # This is basically the same as with the method locale_l10n()
4781             my $all = $cldr->locales_l10n(
4782             locale => 'en',
4783             locale_id => 'ja',
4784             alt => undef,
4785             );
4786             my $ref = $cldr->locales_info( property => 'quotation_start', locale => 'ja' );
4787             my $all = $cldr->locales_infos;
4788             my $ref = $cldr->metazone( metazone => 'Japan' );
4789             my $all = $cldr->metazones;
4790             my $ref = $cldr->number_format_l10n(
4791             locale => 'en',
4792             number_system => 'latn',
4793             number_type => 'currency',
4794             format_length => 'short',
4795             format_type => 'standard',
4796             alt => undef,
4797             count => 'one',
4798             format_id => 1000,
4799             );
4800             my $all = $cldr->number_formats_l10n;
4801             my $all = $cldr->number_formats_l10n( locale => 'en' );
4802             my $all = $cldr->number_formats_l10n(
4803             locale => 'en',
4804             number_system => 'latn',
4805             number_type => 'currency',
4806             format_length => 'short',
4807             format_type => 'standard',
4808             );
4809             my $ref = $cldr->number_symbol_l10n(
4810             locale => 'en',
4811             number_system => 'latn',
4812             property => 'decimal',
4813             alt => undef,
4814             );
4815             my $all = $cldr->number_symbols_l10n;
4816             my $all = $cldr->number_symbols_l10n( locale => 'en' );
4817             my $all = $cldr->number_symbols_l10n(
4818             locale => 'en',
4819             number_system => 'latn',
4820             );
4821             # See also using rbnf
4822             my $ref = $cldr->number_system( number_system => 'jpan' );
4823             my $all = $cldr->number_systems;
4824             my $ref = $cldr->person_name_default( locale => 'ja' );
4825             my $all = $cldr->person_name_defaults;
4826             my $ref = $cldr->rbnf(
4827             locale => 'ja',
4828             ruleset => 'spellout-cardinal',
4829             rule_id => 7,
4830             );
4831              
4832             my $rule = $cldr->plural_forms( 'en' );
4833             # nplurals=2; plural=(n != 1);
4834              
4835             my $rule = $cldr->plural_forms( 'ja' );
4836             # nplurals=1; plural=0;
4837              
4838             my $rule = $cldr->plural_forms( 'ar' );
4839             # nplurals=6; plural=(n==0 ? 0 : n==1 ? 1 : n==2 ? 2 : n%100>=3 && n%100<=10 ? 3 : n%100>=11 ? 4 : 5);
4840              
4841             my $all = $cldr->rbnfs;
4842             my $all = $cldr->rbnfs( locale => 'ko' );
4843             my $all = $cldr->rbnfs( grouping => 'SpelloutRules' );
4844             my $all = $cldr->rbnfs( ruleset => 'spellout-cardinal-native' );
4845             my $ref = $cldr->reference( code => 'R1131' );
4846             my $all = $cldr->references;
4847             my $ref = $cldr->script( script => 'Jpan' );
4848             my $all = $cldr->scripts;
4849             # 'rtl' ('right-to-left' writing orientation)
4850             my $all = $cldr->scripts( rtl => 1 );
4851             my $all = $cldr->scripts( origin_country => 'FR' );
4852             my $all = $cldr->scripts( likely_language => 'fr' );
4853             my $ref = $cldr->script_l10n(
4854             locale => 'en',
4855             script => 'Latn',
4856             alt => undef,
4857             );
4858             my $all = $cldr->scripts_l10n;
4859             my $all = $cldr->scripts_l10n( locale => 'en' );
4860             my $all = $cldr->scripts_l10n(
4861             locale => 'en',
4862             alt => undef,
4863             );
4864             my $ref = $cldr->subdivision( subdivision => 'jp12' );
4865             my $all = $cldr->subdivisions;
4866             my $all = $cldr->subdivisions( territory => 'JP' );
4867             my $all = $cldr->subdivisions( parent => 'US' );
4868             my $all = $cldr->subdivisions( is_top_level => 1 );
4869             my $ref = $cldr->subdivision_l10n(
4870             locale => 'en',
4871             # Texas
4872             subdivision => 'ustx',
4873             );
4874             my $all = $cldr->subdivisions_l10n;
4875             my $all = $cldr->subdivisions_l10n( locale => 'en' );
4876             my $ref = $cldr->territory( territory => 'FR' );
4877             my $all = $cldr->territories;
4878             my $all = $cldr->territories( parent => 150 );
4879             my $ref = $cldr->territory_l10n(
4880             locale => 'en',
4881             territory => 'JP',
4882             alt => undef,
4883             );
4884             my $all = $cldr->territories_l10n;
4885             my $all = $cldr->territories_l10n( locale => 'en' );
4886             my $all = $cldr->territories_l10n(
4887             locale => 'en',
4888             alt => undef,
4889             );
4890             my $ref = $cldr->time_format( region => 'JP' );
4891             my $all = $cldr->time_formats;
4892             my $all = $cldr->time_formats( region => 'US' );
4893             my $all = $cldr->time_formats( territory => 'JP' );
4894             my $all = $cldr->time_formats( locale => undef );
4895             my $all = $cldr->time_formats( locale => 'en' );
4896             my $ref = $cldr->timezone( timezone => 'Asia/Tokyo' );
4897             my $all = $cldr->timezones;
4898             my $all = $cldr->timezones( territory => 'US' );
4899             my $all = $cldr->timezones( region => 'Asia' );
4900             my $all = $cldr->timezones( tzid => 'sing' );
4901             my $all = $cldr->timezones( tz_bcpid => 'sgsin' );
4902             my $all = $cldr->timezones( metazone => 'Singapore' );
4903             my $all = $cldr->timezones( is_golden => undef );
4904             my $all = $cldr->timezones( is_golden => 1 );
4905             my $all = $cldr->timezones( is_primary => 1 );
4906             my $all = $cldr->timezones( is_canonical => 1 );
4907             my $ref = $cldr->timezone_city(
4908             locale => 'fr',
4909             timezone => 'Asia/Tokyo',
4910             );
4911             my $all = $cldr->timezones_cities;
4912             my $ref = $cldr->timezone_info(
4913             timezone => 'Asia/Tokyo',
4914             start => undef,
4915             );
4916             my $ref = $cldr->timezone_info(
4917             timezone => 'Europe/Simferopol',
4918             start => ['>1991-01-01', '<1995-01-01'],
4919             );
4920             my $all = $cldr->timezones_info;
4921             my $all = $cldr->timezones_info( metazone => 'Singapore' );
4922             my $all = $cldr->timezones_info( start => undef );
4923             my $all = $cldr->timezones_info( until => undef );
4924             my $ref = $cldr->unit_alias( alias => 'meter-per-second-squared' );
4925             my $all = $cldr->unit_aliases;
4926             my $ref = $cldr->unit_constant( constant => 'lb_to_kg' );
4927             my $all = $cldr->unit_constants;
4928             my $ref = $cldr->unit_conversion( source => 'kilogram' );
4929             my $all = $cldr->unit_conversions;
4930             my $all = $cldr->unit_conversions( base_unit => 'kilogram' );;
4931             my $all = $cldr->unit_conversions( category => 'kilogram' );
4932             my $ref = $cldr->unit_l10n(
4933             locale => 'en',
4934             # long, narrow, short
4935             format_length => 'long',
4936             # compound, regular
4937             unit_type => 'regular',
4938             unit_id => 'length-kilometer',
4939             count => 'one',
4940             gender => undef,
4941             gram_case => undef,
4942             );
4943             my $all = $cldr->units_l10n;
4944             my $all = $cldr->units_l10n( locale => 'en' );
4945             my $all = $cldr->units_l10n(
4946             locale => 'en',
4947             format_length => 'long',
4948             unit_type => 'regular',
4949             unit_id => 'length-kilometer',
4950             pattern_type => 'regular',
4951             );
4952             my $ref = $cldr->unit_prefix( unit_id => 'micro' );
4953             my $all = $cldr->unit_prefixes;
4954             my $ref = $cldr->unit_pref( unit_id => 'square-meter' );
4955             my $all = $cldr->unit_prefs;
4956             my $all = $cldr->unit_prefs( territory => 'US' );
4957             my $all = $cldr->unit_prefs( category => 'area' );
4958             my $ref = $cldr->unit_quantity( base_unit => 'kilogram' );
4959             my $all = $cldr->unit_quantities;
4960             my $all = $cldr->unit_quantities( quantity => 'mass' );
4961             my $ref = $cldr->variant( variant => 'valencia' );
4962             my $all = $cldr->variants;
4963             my $ref = $cldr->variant_l10n(
4964             locale => 'en',
4965             alt => undef,
4966             variant => 'valencia',
4967             );
4968             my $all = $cldr->variants_l10n;
4969             my $all = $cldr->variants_l10n( locale => 'en' );
4970             my $all = $cldr->variants_l10n(
4971             locale => 'en',
4972             alt => undef,
4973             );
4974             my $ref = $cldr->week_preference( locale => 'ja' );
4975             my $all = $cldr->week_preferences;
4976              
4977             With advanced search:
4978              
4979             my $all = $cldr->timezone_info(
4980             timezone => 'Europe/Simferopol',
4981             start => ['>1991-01-01','<1995-01-01'],
4982             );
4983             my $all = $cldr->time_formats(
4984             region => '~^U.*',
4985             );
4986             my $all = $cldr->time_formats(
4987             region => qr/^U.*/,
4988             );
4989              
4990             Enabling fatal exceptions:
4991              
4992             use v5.34;
4993             use experimental 'try';
4994             no warnings 'experimental';
4995             try
4996             {
4997             my $locale = Locale::Unicode::Data->new( fatal => 1 );
4998             # Missing the 'width' argument
4999             my $str = $cldr->timezone_names( timezone => 'Asia/Tokyo', locale => 'en' );
5000             # More code
5001             }
5002             catch( $e )
5003             {
5004             say "Oops: ", $e->message;
5005             }
5006              
5007             Or, you could set the global variable C<$FATAL_EXCEPTIONS> instead:
5008              
5009             use v5.34;
5010             use experimental 'try';
5011             no warnings 'experimental';
5012             $Locale::Unicode::Data::FATAL_EXCEPTIONS = 1;
5013             try
5014             {
5015             my $locale = Locale::Unicode::Data->new;
5016             # Missing the 'width' argument
5017             my $str = $cldr->timezone_names( timezone => 'Asia/Tokyo', locale => 'en' );
5018             # More code
5019             }
5020             catch( $e )
5021             {
5022             say "Oops: ", $e->message;
5023             }
5024              
5025             =head1 VERSION
5026              
5027             v1.8.0
5028              
5029             =head1 DESCRIPTION
5030              
5031             C<Locale::Unicode::Data> provides access to all the data from the Unicode L<CLDR|https://cldr.unicode.org/> (Common Locale Data Repository), using a SQLite database. This is the most extensive up-to-date L<CLDR|https://cldr.unicode.org/> data you will find on C<CPAN>. It is provided as SQLite data with a great many number of methods to access those data and make it easy for you to retrieve them. Thanks to SQLite, it is very fast.
5032              
5033             SQLite version C<3.6.19> (2009-10-14) or higher is required, as this module relies on foreign keys, which were not fully supported before. If the version is anterior, the module will return an error upon object instantiation.
5034              
5035             It is designed to be extensive in the scope of data that can be accessed, while at the same time, memory-friendly. Access to each method returns data from the SQLite database on a need-basis.
5036              
5037             All the data in this SQLite database are sourced directly and exclusively from the Unicode official L<CLDR|https://cldr.unicode.org/> data using a perl script available in this distribution under the C<scripts> directory. Use C<perldoc scripts/create_database.pl> or C<scripts/create_database.pl --man> to access its POD documentation.
5038              
5039             The C<CLDR> data includes, by design, outdated ones, such as outdated currencies, country codes, or timezones, that C<CLDR> keeps in order to ensure consistency and reliability. For example, for timezones, the Unicode C<LDML> (Locale Data Markup Language) states that "CLDR contains locale data using a time zone ID from the tz database as the key, stability of the IDs is critical." and "Not all TZDB links are in CLDR aliases. CLDR purposefully does not exactly match the Link structure in the TZDB.". See L<https://unicode.org/reports/tr35/#Time_Zone_Identifiers>
5040              
5041             In C<CLDR> parlance, a L<language|https://unicode.org/reports/tr35/tr35.html#Unicode_language_identifier> is a 2 to 3-characters identifier, whereas a C<locale> includes more information, such as a C<language>, a C<script>, a C<territory>, a C<variant>, and possibly much more information. See for that the L<Locale::Unicode> module and the L<LDML specifications|https://unicode.org/reports/tr35/tr35.html#Unicode_language_identifier>
5042              
5043             Those locales also inherit data from their respective parents. For example, C<sr-Cyrl-ME> would have the following inheritance tree: C<sr-ME>, C<sr>, and C<und>
5044              
5045             You can build a C<locale> inheritance tree using L<make_inheritance_tree|/make_inheritance_tree>, and I recommend L<Locale::Unicode> to build, parse and manipulate locales.
5046              
5047             Also, in those C<CLDR> data, there is not always a one-to-one match across all territories (countries) or languages, meaning that some territories or languages have more complete C<CLDR> data than others.
5048              
5049             C<CLDR> also uses some default values to avoid repetitions. Those default values are stored in the C<World> territory with code C<001> and special C<language> code C<und> (a.k.a. C<unknown> also referred as C<root>)
5050              
5051             Please note that the SQLite database is built to not be case sensitive in line with the C<LDML> specifications.
5052              
5053             This module documentation is not meant to be a replacement for the Unicode C<LDML> (C<Locale Data Markup Language>) documentation, so please make sure to read L<the LDML documentation|https://unicode.org/reports/tr35/> and the L<CLDR specifications|https://cldr.unicode.org/index/cldr-spec>.
5054              
5055             The data available from the C<CLDR> via this module includes:
5056              
5057             =over 4
5058              
5059             =item * ISO 4217 L<currencies|/"Table currencies">, including L<BCP47 currencies|/"Table bcp47_currencies">, their L<localised names|/"Table currencies_l10n"> and their L<associated country historical usage|/"Table currencies_info">.
5060              
5061             =item * L<Calendar IDs|/"Table calendars"> with description in English
5062              
5063             =item * L<Calendar eras|/"Table calendar_eras">, for some calendar systems, such as the C<japanese> one.
5064              
5065             =item * L<Territories|/"Table territories"> (countries, or world regions)
5066              
5067             This includes, for countries, additional information such as C<GDP> (Gross Domestic Product), literacy percentage, population size, languages spoken, possible other ISO 3166 codes contained by this territory (essentially world regions identified as 3-digits code, or special codes like C<EU> or C<UN>), the official currency, a list of calendar IDs (not always available for all territories), the first day of the week, the first and last day of the week-end
5068              
5069             =item * L<Localised territory names|/"Table territories_l10n">
5070              
5071             This provides the name of a C<territory> for a given C<locale>
5072              
5073             =item * Territories L<currencies history|/"Table currencies_info">
5074              
5075             =item * All L<known locales|/"Table locales">
5076              
5077             This includes the C<locale> status, which may be C<regular>, C<deprecated>, C<special>, C<reserved>, C<private_use>, or C<unknown>
5078              
5079             =item * Localised L<names of locales|/"Table locales_l10n">
5080              
5081             This provides the name of a C<locale> for a given C<locale>
5082              
5083             =item * All L<known languages|/"Table languages">
5084              
5085             This may include its associated C<scripts> and C<territories>, and its C<parent> language, if any.
5086              
5087             Its status may be C<regular>, C<deprecated>, C<special>, C<reserved>, C<private_use>, or C<unknown>
5088              
5089             =item * All L<known scripts|/"Table scripts">
5090              
5091             This includes possibly the C<script> ID, its rank, a sample character, line break letter, whether it is right-to-left direction, if it has casing, if it requires shapping, its density, possibly its origin territory and its likely locale.
5092              
5093             =item * L<Localised scripts|/"Table scripts_l10n">
5094              
5095             This provides the name of a C<script> for a given C<locale>
5096              
5097             =item * All L<known variants|/"Table variants">
5098              
5099             This includes the C<variant> status, which may be C<regular>, C<deprecated>, C<special>, C<reserved>, C<private_use>, or C<unknown>
5100              
5101             =item * L<Localised variants|/"Table variants_l10n">
5102              
5103             This provides the name of a C<variant> for a given C<locale>
5104              
5105             =item * L<Time formats|/"Table time_formats">
5106              
5107             This includes the associated C<territory> and C<locale>, the default time format, such as C<H> and the time allowed.
5108              
5109             =item * L<Language population|/"Table language_population">
5110              
5111             This provides information for a given C<territory> and C<locale> about the percentage of the population using that C<locale>, their literacy percentage, and percentage of the population using in writing the C<locale>, and its official status, which may be C<official>, C<de_facto_official>, and C<official_regional>
5112              
5113             =item * L<Likely subtags|/"Table likely_subtags">
5114              
5115             This provides for a given C<locale> the likely target locale to expand to.
5116              
5117             =item * L<Aliases|/"Table aliases">
5118              
5119             This provides aliases for C<languages>, C<scripts>, C<territories>, C<subdivisions>, C<variants>, and C<timezones>
5120              
5121             =item * L<Time zones|/"Table timezones">
5122              
5123             This provides IANA Olson time zones, but also some other time zones, such as C<Etc/GMT>. The CLDR data also includes former time zones for consistency and stability.
5124              
5125             The information includes possibly the associated C<territory>, the C<region> such as C<America> or C<Europe>, the time zone ID, such as C<japa>, a meta zone, such as C<Europe_Central>, a BCP47 time zone ID, and a boolean value whether the time zone is a C<golden> time zone or not.
5126              
5127             =item * L<Time zone information|/"Table timezones_info">
5128              
5129             This provides historical time zone information, such as when it started and ended.
5130              
5131             =item * L<Subdivisions|/"Table subdivisions">
5132              
5133             Subdivisions are parts of a territory, such as a province like in Canada, a department like in France or a prefecture like in Japan.
5134              
5135             The information here includes a C<subdivision> ID, possibly a C<parent>, a boolean whether this is a top level subdivision for the given territory, and a status, which may be C<regular>, C<deprecated>, C<special>, C<reserved>, C<private_use>, or C<unknown>
5136              
5137             =item * L<Localised subdivisions|/"Table subdivisions_l10n">
5138              
5139             This contains the name of a C<subdivision> for a given C<locale>
5140              
5141             =item * L<Numbering systems|"Table number_systems">
5142              
5143             This provides information about numbering systems, including the numbering system ID, the digits from C<0> to C<9>
5144              
5145             =item * L<Week preference|/Table week_preferences">
5146              
5147             This contains the week ordering preferences for a given C<locale>. Possible values are: C<weekOfYear>, C<weekOfDate>, C<weekOfMonth>
5148              
5149             =item * L<Day periods|/"Table day_periods">
5150              
5151             This contains the time representation of day period ID, such as C<midnight>, C<noon>, C<morning1>, C<morning2>, C<afternoon1>, C<afternoon2>, C<evening1>, C<evening2>, C<night1>, C<night2> with values in hour and minute, such as C<12:00> set in a C<start> and C<until> field.
5152              
5153             =item * L<Code mappings|/"Table code_mappings">
5154              
5155             This serves to map territory or currency codes with their well known equivalent in ISO and U.S. standard (FIPS10)
5156              
5157             =item * L<Person name defaults|/"Table person_name_defaults">
5158              
5159             This specifies, for a given C<locale>, whether a person's given name comes first before the surname, or after.
5160              
5161             =item * L<References|/"Table refs">
5162              
5163             This contains all the references behind the CLDR data.
5164              
5165             =item * L<BCP47 time zones|/"Table bcp47_timezones">
5166              
5167             This contains BCP 47 time zones along with possible aliases and preferred time zone
5168              
5169             =item * L<BCP47 currencies|/"Table bcp47_currencies">
5170              
5171             This includes the currency ID, an ISO 4217 code, description and a boolean value whether it is obsolete or not.
5172              
5173             =item * L<BCP47 extensions|/"Table bcp47_extensions">
5174              
5175             This contains the extension category, extension ID, possibly alias, value type and description, and whether it is deprecated,
5176              
5177             =item * L<BCP47 extension values|/"Table bcp47_values">
5178              
5179             This includes an extension category, and extension ID, an extension value and description.
5180              
5181             =item * L<Annotations|/"Table annotations">
5182              
5183             This provide annotations (single character like a symbol or an emoji) and default short description for a given C<locale>
5184              
5185             =item * L<RBNF (Rule-Based Number Format)|/"Table rbnf">
5186              
5187             This provides RBNF rules with its grouping value, such as C<SpelloutRules> or C<OrdinalRules>, the rule set ID such as C<spellout-numbering-year> or C<spellout-cardinal>, the rule ID such as C<Inf> and the rule value.
5188              
5189             =item * L<Casings|/"Table casings">
5190              
5191             This provides information about casing for a given C<locale>
5192              
5193             It includes the C<locale>, a C<token> such as C<currencyName>, C<language> and a C<value>, such as C<lowercase>, C<titlecase>
5194              
5195             =item * L<Localised calendar terms|/"Table calendar_terms">
5196              
5197             This provides localised terms used in different parts of a calendar system, for a given C<locale> and C<calendar> ID.
5198              
5199             =item * L<Localised calendar eras|/"Table calendar_eras">
5200              
5201             This provides the localised era names for a given C<locale> and C<calendar> ID.
5202              
5203             =item * Localised L<calendar date, time|/"Table calendar_datetime_formats"> and L<interval formattings|/"Table calendar_interval_formats">
5204              
5205             This provides the C<CLDR> C<DateTime> formattings for a given C<locale> and C<calendar> ID.
5206              
5207             =item * L<Language matching|/"Table languages_match">
5208              
5209             This provides a matching between a desired C<locale> and what is actually supported, and a C<distance> factor, which designed to be the opposite of a percentage, by Unicode. The desired C<locale> can be a perl regular expression.
5210              
5211             =item * Unit L<constants|/"Table unit_constants">
5212              
5213             Some constant values declared for certain measurement units.
5214              
5215             =item * L<Unit quantities|/"Table unit_quantities">
5216              
5217             Defines the quantity type for certain units.
5218              
5219             =item * L<Unit conversions|/"Table unit_conversions">
5220              
5221             Define a list of unit conversion from one unit to another.
5222              
5223             =item * L<Unit preferences by territories|/unit_prefs">
5224              
5225             Defines what units are preferred by territory.
5226              
5227             =item * L<Unit aliases|/"Table unit_aliases">
5228              
5229             Provides some aliases for otherwise outdated units.
5230              
5231             =item * L<Localised units|/"Table units_l10n">
5232              
5233             Localised unit formatting.
5234              
5235             =item * Locale L<Number symbols|/"Table number_symbols_l10n">
5236              
5237             Value used for each locale for C<approximately>, C<currency_decimal>, C<currency_group>, C<decimal>, C<exponential>, C<group>, C<infinity>, C<list>, C<minus>, C<nan>, C<per_mille>, C<percent>, C<plus>, C<superscript>, and C<time_separator>
5238              
5239             Not every C<locale> has a value for each of those properties though.
5240              
5241             =item * L<Locale number formatting|/"Table number_formats_l10n">
5242              
5243             Localised formatting for currency or decimal numbers.
5244              
5245             =back
5246              
5247             If you need a more granular access to the data, feel free to access the SQL data directly. You can retrieve a L<database handler|/database_handler>, as an instance of the L<DBI> API, or you can instantiate a connection yourself using the L<database file information|/datafile>
5248              
5249             =head1 CONSTRUCTOR
5250              
5251             =head2 new
5252              
5253             This takes some hash or hash reference of options, instantiates a new L<Locale::Unicode::Data> object, connects to the SQLite database file specified, or the default one, and returns the newly instantiated object.
5254              
5255             If an error occurred, an L<error object|Locale::Unicode::Data::Exception> is created and C<undef> is returned in scalar context, or an empty list in list context.
5256              
5257             Supported options are as follows. Each option can be later accessed or modified by their associated method.
5258              
5259             =over 4
5260              
5261             =item * C<datafile>
5262              
5263             The file path to the SQLite database file. If this option is not provided, the SQLite database file used will be the one set in the global variable C<$DB_FILE>
5264              
5265             =item * C<decode_sql_arrays>
5266              
5267             Boolean value to enable or disable automatic decoding of SQL arrays into perl arrays using L<JSON::XS>
5268              
5269             This is enabled by default.
5270              
5271             If you want to retrieve a lot of data and do not need access to those arrays, you should deactivate decoding to improve speed.
5272              
5273             =back
5274              
5275             If an error occurs, an L<exception object|Locale::Unicode::Data::Exception> is set and C<undef> is returned in scalar context, or an empty list in list context. The L<exception object|Locale::Unicode::Data::Exception> can then be retrieved using L<error|/error>, such as:
5276              
5277             my $cldr = Locale::Unicode::Data->new( $somthing_bad ) ||
5278             die( Locale::Unicode::Data->error );
5279              
5280             =head1 METHODS
5281              
5282             =head2 alias
5283              
5284             my $ref = $cldr->alias(
5285             alias => 'i_klingon',
5286             type => 'language',
5287             );
5288              
5289             This would return an hash reference containing:
5290              
5291             {
5292             alias_id => 5,
5293             alias => 'i_klingon',
5294             replacement => ["tlh"],
5295             reason => 'deprecated',
5296             type => 'language',
5297             comment => 'Klingon',
5298             }
5299              
5300             Returns the C<language>, C<script>, C<territory>, C<subdivision>, C<variant>, or C<zone> aliases stored in table L<aliases|/"Table aliases"> for a given C<alias> and an alias C<type>.
5301              
5302             See the L<LDML specifications|https://unicode.org/reports/tr35/tr35-info.html#Supplemental_Alias_Information> for more information.
5303              
5304             The meaning of the fields are as follows:
5305              
5306             =over 4
5307              
5308             =item * C<alias_id>
5309              
5310             A unique incremental value provided by SQLite.
5311              
5312             =item * C<alias>
5313              
5314             The original value.
5315              
5316             =item * C<replacement>
5317              
5318             The replacement value for the C<alias>
5319              
5320             =item * C<reason>
5321              
5322             Reason for the replacement.
5323              
5324             Known reasons are C<bibliographic>, C<deprecated>, C<legacy>, C<macrolanguage>, C<overlong>
5325              
5326             =item * C<type>
5327              
5328             The type of alias.
5329              
5330             There are 6 types of aliases:
5331              
5332             =over 4
5333              
5334             =item 1. C<language>
5335              
5336             =item 2. C<script>
5337              
5338             =item 3. C<subdivision>
5339              
5340             =item 4. C<territory>
5341              
5342             =item 5. C<variant>
5343              
5344             =item 6. C<zone>
5345              
5346             =back
5347              
5348             =item * C<comment>
5349              
5350             A possible comment
5351              
5352             =back
5353              
5354             =head2 aliases
5355              
5356             my $array_ref = $cldr->aliases;
5357             # Filtering based on type
5358             my $array_ref = $cldr->aliases( type => 'language' );
5359             my $array_ref = $cldr->aliases( type => 'script' );
5360             my $array_ref = $cldr->aliases( type => 'subdivision' );
5361             my $array_ref = $cldr->aliases( type => 'territory' );
5362             my $array_ref = $cldr->aliases( type => 'variant' );
5363             my $array_ref = $cldr->aliases( type => 'zone' );
5364              
5365             Returns all the data stored in table L<aliases|/"Table aliases"> as an array reference of hash reference.
5366              
5367             If an C<type> option is provided, it will return only all the data matching the given C<type>.
5368              
5369             See the L<LDML specifications|https://unicode.org/reports/tr35/tr35-info.html#Supplemental_Alias_Information> for more information.
5370              
5371             =head2 annotation
5372              
5373             my $ref = $cldr->annotation( locale => 'en', annotation => '{' );
5374             # Returns an hash reference like this:
5375             {
5376             annotation_id => 34686,
5377             locale => 'en',
5378             annotation => '{',
5379             defaults => ["brace", "bracket", "curly brace", "curly bracket", "gullwing", "open curly bracket"],
5380             tts => 'open curly bracket',
5381             }
5382              
5383             Returns an hash reference of a C<annotation> information from the table L<annotations|/"Table annotations"> for a given C<locale> ID, and C<annotation> value.
5384              
5385             As per the L<LDML specifications|https://unicode.org/reports/tr35/tr35-general.html#Annotations>, "Annotations provide information about characters, typically used in input. For example, on a mobile keyboard they can be used to do completion. They are typically used for symbols, especially emoji characters."
5386              
5387             The meaning of the fields are as follows:
5388              
5389             =over 4
5390              
5391             =item * C<annotation_id>
5392              
5393             A unique incremental value automatically generated by SQLite.
5394              
5395             =item * C<locale>
5396              
5397             A C<locale> ID as can be found in the table L<locales|/"Table locales">
5398              
5399             =item * C<annotation>
5400              
5401             A string representing the C<annotation>
5402              
5403             =item * C<defaults>
5404              
5405             An array of short strings describing the annotation in the language specified by the C<locale>
5406              
5407             =item * C<tts>
5408              
5409             A short string describing the C<annotation>
5410              
5411             =back
5412              
5413             =head2 annotations
5414              
5415             my $array_ref = $cldr->annotations;
5416             # Get all annotations for locale 'en'
5417             my $array_ref = $cldr->annotations( locale => 'en' );
5418              
5419             Returns all annotations information for all known locales from the L<table annotations|/"Table annotations"> as an array reference of hash reference.
5420              
5421             Alternatively, you can provide a C<locale> to return all annotation information for that C<locale>
5422              
5423             =head2 bcp47_currency
5424              
5425             my $ref = $cldr->bcp47_currency( currid => 'jpy' );
5426             # Returns an hash reference like this:
5427             {
5428             bcp47_curr_id => 133,
5429             currid => 'jpy',
5430             code => 'JPY',
5431             description => 'Japanese Yen',
5432             is_obsolete => 0,
5433             }
5434              
5435             Returns an hash reference of a BCP47 currency information from the table L<bcp47_currencies|/"Table bcp47_currencies"> for a given BCP47 currency ID C<currid>.
5436              
5437             The meaning of the fields are as follows:
5438              
5439             =over 4
5440              
5441             =item * C<bcp47_curr_id>
5442              
5443             A unique incremental value automatically generated by SQLite.
5444              
5445             =item * C<currid>
5446              
5447             A string representing a BCP47 C<currency> ID.
5448              
5449             =item * C<code>
5450              
5451             A string representing a ISO 4217 C<currency> code, which could be outdated by the ISO standard, but still valid for C<CLDR>
5452              
5453             =item * C<description>
5454              
5455             A text describing the C<currency>
5456              
5457             =item * C<is_obsolete>
5458              
5459             A boolean value defining whether the C<currency> is obsolete or not. Default to false.
5460              
5461             =back
5462              
5463             =head2 bcp47_currencies
5464              
5465             my $array_ref = $cldr->bcp47_currencies;
5466             # Filtering based on ISO4217 currency code
5467             my $array_ref = $cldr->bcp47_currencies( code => 'JPY' );
5468             # Filtering based on obsolete status: 1 = true, 0 = false
5469             my $array_ref = $cldr->bcp47_currencies( is_obsolete => 1 );
5470              
5471             Returns all BCP47 currencies information from L<table bcp47_currencies|/"Table bcp47_currencies"> as an array reference of hash reference.
5472              
5473             A combination of the following fields may be provided to filter the information returned:
5474              
5475             =over 4
5476              
5477             =item * C<code>
5478              
5479             An ISO4217 currency code, such as C<JPY>
5480              
5481             =item * C<is_obsolete>
5482              
5483             A boolean value. Use 1 for C<true> and 0 for C<false>
5484              
5485             =back
5486              
5487             =head2 bcp47_extension
5488              
5489             my $ref = $cldr->bcp47_extension( extension => 'ca' );
5490             # Returns an hash reference like this:
5491             {
5492             bcp47_ext_id => 1,
5493             category => 'calendar',
5494             extension => 'ca',
5495             alias => 'calendar',
5496             value_type => 'incremental',
5497             description => 'Calendar algorithm key',
5498             }
5499              
5500             Returns an hash reference of a L<BCP47 extension|https://unicode.org/reports/tr35/tr35.html#u_Extension> information from the table L<bcp47_extensions|/"Table bcp47_extensions"> for a given BCP47 extension.
5501              
5502             The meaning of the fields are as follows:
5503              
5504             =over 4
5505              
5506             =item * C<bcp47_ext_id>
5507              
5508             A unique incremental value automatically generated by SQLite.
5509              
5510             =item * C<category>
5511              
5512             A string representing a BCP47 extension category.
5513              
5514             Known values are: C<calendar>, C<collation>, C<currency>, C<measure>, C<number>, C<segmentation>, C<timezone>, C<transform>, C<transform_destination>, C<transform_hybrid>, C<transform_ime>, C<transform_keyboard>, C<transform_mt>, C<transform_private_use>, C<variant>
5515              
5516             =item * C<extension>
5517              
5518             A short string representing a BCP47 extension.
5519              
5520             Known values are: C<ca>, C<cf>, C<co>, C<cu>, C<d0>, C<dx>, C<em>, C<fw>, C<h0>, C<hc>, C<i0>, C<k0>, C<ka>, C<kb>, C<kc>, C<kf>, C<kh>, C<kk>, C<kn>, C<kr>, C<ks>, C<kv>, C<lb>, C<lw>, C<m0>, C<ms>, C<mu>, C<nu>, C<rg>, C<s0>, C<sd>, C<ss>, C<t0>, C<tz>, C<va>, C<vt>, C<x0>
5521              
5522             =item * C<alias>
5523              
5524             A string representing an alias for this extension.
5525              
5526             Known values are: C<undef>, C<calendar>, C<colAlternate>, C<colBackwards>, C<colCaseFirst>, C<colCaseLevel>, C<colHiraganaQuaternary>, C<collation>, C<colNormalization>, C<colNumeric>, C<colReorder>, C<colStrength>, C<currency>, C<hours>, C<measure>, C<numbers>, C<timezone>, C<variableTop>
5527              
5528             =item * C<value_type>
5529              
5530             A string representing a value type.
5531              
5532             Known values are: C<undef>, C<any>, C<incremental>, C<multiple>, C<single>
5533              
5534             =item * C<description>
5535              
5536             A text providing a description for this BCP47 extension.
5537              
5538             =back
5539              
5540             =head2 bcp47_extensions
5541              
5542             my $array_ref = $cldr->bcp47_extensions;
5543             # Filter based on the 'extension' field value
5544             my $array_ref = $cldr->bcp47_extensions( extension => 'ca' );
5545             # Filter based on the 'deprecated' field value; 1 = true, 0 = false
5546             my $array_ref = $cldr->bcp47_extensions( deprecated => 0 );
5547              
5548             Returns all L<BCP47 extensions|https://unicode.org/reports/tr35/tr35.html#u_Extension> information from L<table bcp47_extensions|/"Table bcp47_extensions"> as an array reference of hash reference.
5549              
5550             A combination of the following fields may be provided to filter the information returned:
5551              
5552             =over 4
5553              
5554             =item * C<deprecated>
5555              
5556             A boolean value. Use 1 for C<true> and 0 for C<false>
5557              
5558             =item * C<extension>
5559              
5560             A BCP47 extension, such as C<ca>, C<cf>, C<co>, C<cu>, C<d0>, C<dx>, C<em>, C<fw>, C<h0>, C<hc>, C<i0>, C<k0>, C<ka>, C<kb>, C<kc>, C<kf>, C<kh>, C<kk>, C<kn>, C<kr>, C<ks>, C<kv>, C<lb>, C<lw>, C<m0>, C<ms>, C<mu>, C<nu>, C<rg>, C<s0>, C<sd>, C<ss>, C<t0>, C<tz>, C<va>, C<vt>, C<x0>
5561              
5562             =back
5563              
5564             =head2 bcp47_timezone
5565              
5566             my $ref = $cldr->bcp47_timezone( tzid => 'jptyo' );
5567             # Returns an hash reference like this:
5568             {
5569             bcp47_tz_id => 215,
5570             tzid => 'jptyo',
5571             alias => ["Asia/Tokyo", "Japan"],
5572             preferred => undef,
5573             description => 'Tokyo, Japan',
5574             deprecated => undef,
5575             }
5576              
5577             Returns an hash reference of a BCP47 timezone information from the table L<bcp47_timezones|/"Table bcp47_timezones"> for a given BCP47 timezone ID C<tzid>.
5578              
5579             The meaning of the fields are as follows:
5580              
5581             =over 4
5582              
5583             =item * C<bcp47_tz_id>
5584              
5585             A unique incremental value automatically generated by SQLite.
5586              
5587             =item * C<tzid>
5588              
5589             A string representing a BCP47 timezone ID.
5590              
5591             =item * C<alias>
5592              
5593             An array of L<IANA Olson timezones|https://www.iana.org/time-zones>
5594              
5595             =item * C<preferred>
5596              
5597             An string representing a preferred BCP47 timezone ID in lieu of the current one.
5598              
5599             This is mostly C<undef>
5600              
5601             =item * C<description>
5602              
5603             A text describing the BCP47 timezone
5604              
5605             =item * C<deprecated>
5606              
5607             A boolean value defining whether this timezone is deprecated or not. Defaults to false.
5608              
5609             =back
5610              
5611             =head2 bcp47_timezones
5612              
5613             my $array_ref = $cldr->bcp47_timezones;
5614             # Filter based on the 'deprecated' field value; 1 = true, 0 = false
5615             my $array_ref = $cldr->bcp47_timezones( deprecated => 0 );
5616              
5617             Returns all BCP47 timezones information from L<table bcp47_timezones|/"Table bcp47_timezones"> as an array reference of hash reference.
5618              
5619             A combination of the following fields may be provided to filter the information returned:
5620              
5621             =over 4
5622              
5623             =item * C<deprecated>
5624              
5625             A boolean value. Use 1 for C<true> and 0 for C<false>
5626              
5627             =back
5628              
5629             =head2 bcp47_value
5630              
5631             my $ref = $cldr->bcp47_value( value => 'japanese' );
5632             # Returns an hash reference like this:
5633             {
5634             bcp47_value_id => 16,
5635             category => 'calendar',
5636             extension => 'ca',
5637             value => 'japanese',
5638             description => 'Japanese Imperial calendar',
5639             }
5640              
5641             Returns an hash reference of a BCP47 value information from the table L<bcp47_values|/"Table bcp47_values"> for a given BCP47 value.
5642              
5643             The meaning of the fields are as follows:
5644              
5645             =over 4
5646              
5647             =item * C<bcp47_value_id>
5648              
5649             A unique incremental value automatically generated by SQLite.
5650              
5651             =item * C<category>
5652              
5653             A string representing a BCP47 value category.
5654              
5655             Known values are: C<calendar>, C<collation>, C<currency>, C<measure>, C<number>, C<segmentation>, C<timezone>, C<transform>, C<transform_destination>, C<transform_hybrid>, C<transform_ime>, C<transform_keyboard>, C<transform_mt>, C<transform_private_use>, C<variant>
5656              
5657             =item * C<extension>
5658              
5659             A short string representing a BCP47 extension.
5660              
5661             Known values are: C<ca>, C<cf>, C<co>, C<cu>, C<d0>, C<dx>, C<em>, C<fw>, C<h0>, C<hc>, C<i0>, C<k0>, C<ka>, C<kb>, C<kc>, C<kf>, C<kh>, C<kk>, C<kn>, C<kr>, C<ks>, C<kv>, C<lb>, C<lw>, C<m0>, C<ms>, C<mu>, C<nu>, C<rg>, C<s0>, C<sd>, C<ss>, C<t0>, C<tz>, C<va>, C<vt>, C<x0>
5662              
5663             =item * C<value>
5664              
5665             Possible value for the current BCP47 extension. One C<extension> may have multiple possible values.
5666              
5667             =item * C<description>
5668              
5669             A text describing the BCP47 extension value.
5670              
5671             =back
5672              
5673             =head2 bcp47_values
5674              
5675             my $array_ref = $cldr->bcp47_values;
5676             # Filter based on the 'category' field value
5677             my $array_ref = $cldr->bcp47_timezones( category => 'calendar' );
5678             # Filter based on the 'extension' field value
5679             my $array_ref = $cldr->bcp47_timezones( extension => 'ca' );
5680              
5681             Returns all BCP47 values information from L<table bcp47_values|/"Table bcp47_values"> as an array reference of hash reference.
5682              
5683             A combination of the following fields may be provided to filter the information returned:
5684              
5685             =over 4
5686              
5687             =item * C<category>
5688              
5689             A BCP47 category ID, such as C<calendar>, C<collation>, C<currency>, C<measure>, C<number>, C<segmentation>, C<timezone>, C<transform_destination>, C<transform>, C<transform_hybrid>, C<transform_ime>, C<transform_keyboard>, C<transform_mt>, C<transform_private_use>, C<variant>
5690              
5691             =item * C<extension>
5692              
5693             A BCP47 extension ID, such as C<ca>, C<cf>, C<co>, C<cu>, C<d0>, C<dx>, C<em>, C<fw>, C<h0>, C<hc>, C<i0>, C<k0>, C<ka>, C<kb>, C<kc>, C<kf>, C<kh>, C<kk>, C<kn>, C<kr>, C<ks>, C<kv>, C<lb>, C<lw>, C<m0>, C<ms>, C<mu>, C<nu>, C<rg>, C<s0>, C<sd>, C<ss>, C<t0>, C<tz>, C<va>, C<vt>, C<x0>
5694              
5695             =back
5696              
5697             =head2 calendar
5698              
5699             my $ref = $cldr->calendar( calendar => 'gregorian' );
5700             # Returns an hash reference like this:
5701             {
5702             calendar_id => 1,
5703             calendar => 'gregorian',
5704             system => 'solar',
5705             inherits => undef,
5706             description => undef,
5707             }
5708              
5709             Returns an hash reference of a calendar information from the table L<calendars|/"Table calendars"> for a given C<calendar> value.
5710              
5711             The meaning of the fields are as follows:
5712              
5713             =over 4
5714              
5715             =item * C<calendar_id>
5716              
5717             A unique incremental value automatically generated by SQLite.
5718              
5719             =item * C<calendar>
5720              
5721             A string representing a C<calendar> ID.
5722              
5723             Known calendar IDs are: C<buddhist>, C<chinese>, C<coptic>, C<dangi>, C<ethiopic>, C<ethiopic-amete-alem>, C<generic>, C<gregorian>, C<hebrew>, C<indian>, C<islamic>, C<islamic-civil>, C<islamic-rgsa>, C<islamic-tbla>, C<islamic-umalqura>, C<iso8601>, C<japanese>, C<persian>, C<roc>
5724              
5725             =item * C<system>
5726              
5727             A string representing a C<calendar> system.
5728              
5729             Known values are: C<undef>, C<lunar>, C<lunisolar>, C<other>, C<solar>
5730              
5731             =item * C<inherits>
5732              
5733             A string representing the C<calendar> ID from which this calendar inherits from.
5734              
5735             Currently, the only one known to use this is the C<japanese> calendar inheriting from the C<gregorian> calendar.
5736              
5737             =item * C<description>
5738              
5739             A text describing the C<calendar>
5740              
5741             =back
5742              
5743             =head2 calendars
5744              
5745             my $array_ref = $cldr->calendars;
5746             # Known 'system' value: undef, lunar, lunisolar, other, solar
5747             my $array_ref = $cldr->calendars( system => 'solar' );
5748             my $array_ref = $cldr->calendars( inherits => 'gregorian' );
5749              
5750             Returns all calendar information from L<table calendars|/"Table calendars"> as an array reference of hash reference.
5751              
5752             A combination of the following fields may be provided to filter the information returned:
5753              
5754             =over 4
5755              
5756             =item * C<inherits>
5757              
5758             A calendar system this calendar inherits from, such as the Japanese calendar.
5759              
5760             =item * C<system>
5761              
5762             A calendar system, such as C<lunar>, C<lunisolar>, C<other>, C<solar>
5763              
5764             =back
5765              
5766             =head2 calendar_append_format
5767              
5768             my $ref = $cldr->calendar_append_format(
5769             locale => 'en',
5770             calendar => 'gregorian',
5771             format_id => 'Day',
5772             );
5773             # Returns an hash reference like this:
5774             {
5775             cal_append_fmt_id => 12,
5776             locale => 'en',
5777             calendar => 'gregorian',
5778             format_id => 'Day',
5779             format_pattern => '{0} ({2}: {1})',
5780             }
5781              
5782             Returns an hash reference of a C<calendar> localised append format information from the table L<calendar_append_formats|/"Table calendar_append_formats"> for a given format ID C<format_id>, C<locale> ID and C<calendar> ID.
5783              
5784             The meaning of the fields are as follows:
5785              
5786             =over 4
5787              
5788             =item * C<cal_append_fmt_id>
5789              
5790             A unique incremental value automatically generated by SQLite.
5791              
5792             =item * C<locale>
5793              
5794             A C<locale>, such as C<en> or C<ja-JP> as can be found in table L<locales|/"Table locales">
5795              
5796             =item * C<calendar>
5797              
5798             A C<calendar> ID as can be found in the L<table calendars|/"Table calendars">
5799              
5800             Known values are: C<buddhist>, C<chinese>, C<coptic>, C<dangi>, C<ethiopic>, C<ethiopic-amete-alem>, C<generic>, C<gregorian>, C<hebrew>, C<indian>, C<islamic>, C<islamic-civil>, C<islamic-rgsa>, C<islamic-tbla>, C<islamic-umalqura>, C<japanese>, C<persian>, C<roc>
5801              
5802             =item * C<format_id>
5803              
5804             A string representing a format ID.
5805              
5806             Known values are: C<Day>, C<Day-Of-Week>, C<Era>, C<Hour>, C<Minute>, C<Month>, C<Quarter>, C<Second>, C<Timezone>, C<Week>, C<Year>
5807              
5808             =item * C<format_pattern>
5809              
5810             A string representing the localised format pattern.
5811              
5812             =back
5813              
5814             See the L<LDML specifications|https://unicode.org/reports/tr35/tr35-dates.html#availableFormats_appendItems> for more information.
5815              
5816             =head2 calendar_append_formats
5817              
5818             my $array_ref = $cldr->calendar_append_formats;
5819             # Filter based on the 'locale' field value
5820             my $array_ref = $cldr->calendar_append_formats( locale => 'en' );
5821             # Filter based on the 'calendar' field value
5822             my $array_ref = $cldr->calendar_append_formats( calendar => 'gregorian' );
5823             # or a combination of those two:
5824             my $array_ref = $cldr->calendar_append_formats(
5825             locale => 'en',
5826             calendar => 'gregorian'
5827             );
5828              
5829             Returns all calendar appended formats information from L<table calendar_append_formats|/"Table calendar_append_formats"> as an array reference of hash reference.
5830              
5831             A combination of the following fields may be provided to filter the information returned:
5832              
5833             =over 4
5834              
5835             =item * C<calendar>
5836              
5837             A C<calendar> ID as can be found in table L<calendars|/"Table calendars">, such as: C<buddhist>, C<chinese>, C<coptic>, C<dangi>, C<ethioaa>, C<ethiopic>, C<gregory>, C<hebrew>, C<indian>, C<islamic>, C<islamic-civil>, C<islamic-rgsa>, C<islamic-tbla>, C<islamic-umalqura>, C<islamicc>, C<iso8601>, C<japanese>, C<persian>, C<roc>
5838              
5839             =item * C<locale>
5840              
5841             A C<locale>, such as C<en> or C<ja-JP> as can be found in table L<locales|/"Table locales">
5842              
5843             =back
5844              
5845             See also the method L<l10n|/l10n>
5846              
5847             =head2 calendar_available_format
5848              
5849             my $ref = $cldr->calendar_available_format(
5850             locale => 'en',
5851             calendar => 'gregorian',
5852             format_id => 'Hms',
5853             # optional
5854             count => undef,
5855             # optional
5856             alt => undef,
5857             );
5858             # Returns an hash reference like this:
5859             {
5860             cal_avail_fmt_id => 2662,
5861             locale => 'en',
5862             calendar => 'gregorian',
5863             format_id => 'Hms',
5864             format_pattern => 'HH:mm:ss',
5865             count => undef,
5866             alt => undef,
5867             }
5868              
5869             Returns an hash reference of a C<calendar> localised available format information from the table L<calendar_available_formats|/"Table calendar_available_formats"> for a given format ID C<format_id>, C<calendar> ID and a C<locale> ID.
5870              
5871             The meaning of the fields are as follows:
5872              
5873             =over 4
5874              
5875             =item * C<cal_avail_fmt_id>
5876              
5877             A unique incremental value automatically generated by SQLite.
5878              
5879             =item * C<locale>
5880              
5881             A C<locale>, such as C<en> or C<ja-JP> as can be found in table L<locales|/"Table locales">
5882              
5883             =item * C<calendar>
5884              
5885             A C<calendar> ID as can be found in the L<table calendars|/"Table calendars">
5886              
5887             Known values are: C<buddhist>, C<chinese>, C<coptic>, C<dangi>, C<ethiopic>, C<ethiopic-amete-alem>, C<generic>, C<gregorian>, C<hebrew>, C<indian>, C<islamic>, C<islamic-civil>, C<islamic-rgsa>, C<islamic-tbla>, C<islamic-umalqura>, C<japanese>, C<persian>, C<roc>
5888              
5889             =item * C<format_id>
5890              
5891             A string representing a format ID.
5892              
5893             There are currently 107 known and distinct format IDs.
5894              
5895             =item * C<format_pattern>
5896              
5897             A string representing a localised format pattern.
5898              
5899             =item * C<count>
5900              
5901             An optional string used to differentiate identical patterns.
5902              
5903             Known values are: C<undef>, C<few>, C<many>, C<one>, C<other>, C<two>, C<zero>
5904              
5905             =item * C<alt>
5906              
5907             An optional string used to provide alternative patterns.
5908              
5909             Known values are: C<undef>, C<ascii>, C<variant>
5910              
5911             =back
5912              
5913             See the L<LDML specifications|https://unicode.org/reports/tr35/tr35-dates.html#availableFormats_appendItems> for more informations.
5914              
5915             =head2 calendar_available_formats
5916              
5917             my $array_ref = $cldr->calendar_available_formats;
5918             # Filter based on the 'locale' field value
5919             my $array_ref = $cldr->calendar_available_formats( locale => 'en' );
5920             # Filter based on the 'calendar' field value
5921             my $array_ref = $cldr->calendar_available_formats( calendar => 'gregorian' );
5922             # or a combination of those two:
5923             my $array_ref = $cldr->calendar_available_formats(
5924             locale => 'en',
5925             calendar => 'gregorian',
5926             );
5927              
5928             Returns all calendar available formats information from L<table calendar_available_formats|/"Table calendar_available_formats"> as an array reference of hash reference.
5929              
5930             A combination of the following fields may be provided to filter the information returned:
5931              
5932             =over 4
5933              
5934             =item * C<calendar>
5935              
5936             A C<calendar> ID as can be found in table L<calendars|/"Table calendars">, such as: C<buddhist>, C<chinese>, C<coptic>, C<dangi>, C<ethioaa>, C<ethiopic>, C<gregory>, C<hebrew>, C<indian>, C<islamic>, C<islamic-civil>, C<islamic-rgsa>, C<islamic-tbla>, C<islamic-umalqura>, C<islamicc>, C<iso8601>, C<japanese>, C<persian>, C<roc>
5937              
5938             =item * C<locale>
5939              
5940             A C<locale>, such as C<en> or C<ja-JP> as can be found in table L<locales|/"Table locales">
5941              
5942             =back
5943              
5944             See also the method L<l10n|/l10n>
5945              
5946             =head2 calendar_cyclic_l10n
5947              
5948             my $ref = $cldr->calendar_cyclic_l10n(
5949             locale => 'und',
5950             calendar => 'chinese',
5951             format_set => 'dayParts',
5952             format_type => 'format',
5953             format_length => 'abbreviated',
5954             format_id => 1,
5955             );
5956             # Returns an hash reference like this:
5957             {
5958             cal_int_fmt_id => 1014,
5959             locale => 'und',
5960             calendar => 'chinese',
5961             format_set => 'dayParts',
5962             format_type => 'format',
5963             format_length => 'abbreviated',
5964             format_id => 1,
5965             format_pattern => 'zi',
5966             }
5967              
5968             Returns an hash reference of a C<calendar> cyclic localised information from the table L<calendar_cyclics_l10n|/"Table calendar_cyclics_l10n"> for a given format ID C<format_id>, ID a C<locale> ID, a C<calendar> ID, a format set C<format_set>, a format type C<format_type> and a format length C<format_length>.
5969              
5970             This is typical of calendars such as: C<chinese> and C<dangi>
5971              
5972             The meaning of the fields are as follows:
5973              
5974             =over 4
5975              
5976             =item * C<cal_int_fmt_id>
5977              
5978             A unique incremental value automatically generated by SQLite.
5979              
5980             =item * C<locale>
5981              
5982             A C<locale>, such as C<en> or C<ja-JP> as can be found in table L<locales|/"Table locales">
5983              
5984             =item * C<calendar>
5985              
5986             A C<calendar> ID as can be found in the L<table calendars|/"Table calendars">
5987              
5988             Known values are: C<buddhist>, C<chinese>, C<coptic>, C<dangi>, C<ethiopic>, C<ethiopic-amete-alem>, C<generic>, C<gregorian>, C<hebrew>, C<indian>, C<islamic>, C<islamic-civil>, C<islamic-rgsa>, C<islamic-tbla>, C<islamic-umalqura>, C<japanese>, C<persian>, C<roc>
5989              
5990             =item * C<format_set>
5991              
5992             A format set. Known values are: C<dayParts>, C<days>, C<months>, C<solarTerms>, C<years>, C<zodiacs>
5993              
5994             =item * C<format_type>
5995              
5996             A format type. The only known value is C<format>
5997              
5998             =item * C<format_length>
5999              
6000             A format length.
6001              
6002             Known values are; C<abbreviated>, C<narrow>, C<wide>
6003              
6004             =item * C<format_id>
6005              
6006             A string representing a format ID.
6007              
6008             =item * C<format_pattern>
6009              
6010             A string representing a localised pattern.
6011              
6012             =back
6013              
6014             See the L<LDML specifications|https://unicode.org/reports/tr35/tr35-dates.html#monthPatterns_cyclicNameSets> for more information.
6015              
6016             =head2 calendar_cyclics_l10n
6017              
6018             my $all = $cldr->calendar_cyclics_l10n;
6019             my $all = $cldr->calendar_cyclics_l10n( locale => 'en' );
6020             my $all = $cldr->calendar_cyclics_l10n(
6021             locale => 'en',
6022             calendar => 'chinese',
6023             format_set => 'dayParts',
6024             # Not really needed since 'format' is the only value being currently used
6025             # format_type => 'format',
6026             format_length => 'abbreviated',
6027             );
6028              
6029             Returns all C<calendar> cyclic localised formats information from L<table calendar_cyclics_l10n|/"Table calendar_cyclics_l10n"> as an array reference of hash reference.
6030              
6031             A combination of the following fields may be provided to filter the information returned:
6032              
6033             =over 4
6034              
6035             =item * C<calendar>
6036              
6037             A C<calendar> ID as can be found in table L<calendars|/"Table calendars">, such as: C<buddhist>, C<chinese>, C<coptic>, C<dangi>, C<ethioaa>, C<ethiopic>, C<gregory>, C<hebrew>, C<indian>, C<islamic>, C<islamic-civil>, C<islamic-rgsa>, C<islamic-tbla>, C<islamic-umalqura>, C<islamicc>, C<iso8601>, C<japanese>, C<persian>, C<roc>
6038              
6039             =item * C<locale>
6040              
6041             A C<locale>, such as C<en> or C<ja-JP> as can be found in table L<locales|/"Table locales">
6042              
6043             =item * C<format_set>
6044              
6045             A string representing a format set.
6046              
6047             Known values are: C<dayParts>, C<days>, C<months>, C<solarTerms>, C<years>, C<zodiacs>
6048              
6049             =item * C<format_type>
6050              
6051             A format type. The only known value is C<format>
6052              
6053             =item * C<format_length>
6054              
6055             A format length.
6056              
6057             Known values are; C<abbreviated>, C<narrow>, C<wide>
6058              
6059             =back
6060              
6061             =head2 calendar_datetime_format
6062              
6063             my $ref = $cldr->calendar_datetime_format(
6064             locale => 'en',
6065             calendar => 'gregorian',
6066             format_length => 'full',
6067             format_type => 'atTime',
6068             );
6069             # Returns an hash reference like this:
6070             {
6071             cal_dt_fmt_id => 434,
6072             locale => 'en',
6073             calendar => 'gregorian',
6074             format_length => 'full',
6075             format_type => 'atTime',
6076             format_pattern => "{1} 'at' {0}",
6077             }
6078              
6079             Returns an hash reference of a C<calendar> localised datetime format information from the table L<calendar_datetime_formats|/"Table calendar_datetime_formats"> for a given C<locale> ID, C<calendar> ID, C<format_length>, and C<format_type>.
6080              
6081             The meaning of the fields are as follows:
6082              
6083             =over 4
6084              
6085             =item * C<cal_dt_fmt_id>
6086              
6087             A unique incremental value automatically generated by SQLite.
6088              
6089             =item * C<locale>
6090              
6091             A C<locale>, such as C<en> or C<ja-JP> as can be found in table L<locales|/"Table locales">
6092              
6093             =item * C<calendar>
6094              
6095             A C<calendar> ID as can be found in the L<table calendars|/"Table calendars">
6096              
6097             Known values are: C<buddhist>, C<chinese>, C<coptic>, C<dangi>, C<ethiopic>, C<ethiopic-amete-alem>, C<generic>, C<gregorian>, C<hebrew>, C<indian>, C<islamic>, C<islamic-civil>, C<islamic-rgsa>, C<islamic-tbla>, C<islamic-umalqura>, C<japanese>, C<persian>, C<roc>
6098              
6099             =item * C<format_length>
6100              
6101             A string representing a format length.
6102              
6103             Known values are: C<full>, C<long>, C<medium>, C<short>
6104              
6105             =item * C<format_type>
6106              
6107             A string representing a format type.
6108              
6109             Known values are: C<atTime>, C<standard>
6110              
6111             =item * C<format_pattern>
6112              
6113             A string representing a localised datetime format pattern according to the format type and C<locale>
6114              
6115             =back
6116              
6117             =head2 calendar_datetime_formats
6118              
6119             my $array_ref = $cldr->calendar_datetime_formats;
6120             # Filter based on the 'locale' field value
6121             my $array_ref = $cldr->calendar_datetime_formats( locale => 'en' );
6122             # Filter based on the 'calendar' field value
6123             my $array_ref = $cldr->calendar_datetime_formats( calendar => 'gregorian' );
6124             # or a combination of those two:
6125             my $array_ref = $cldr->calendar_datetime_formats(
6126             locale => 'en',
6127             calendar => 'gregorian',
6128             );
6129              
6130             Returns all calendar datetime formats information from L<table calendar_datetime_formats|/"Table calendar_datetime_formats"> as an array reference of hash reference.
6131              
6132             A combination of the following fields may be provided to filter the information returned:
6133              
6134             =over 4
6135              
6136             =item * C<calendar>
6137              
6138             A C<calendar> ID as can be found in table L<calendars|/"Table calendars">, such as: C<buddhist>, C<chinese>, C<coptic>, C<dangi>, C<ethioaa>, C<ethiopic>, C<gregory>, C<hebrew>, C<indian>, C<islamic>, C<islamic-civil>, C<islamic-rgsa>, C<islamic-tbla>, C<islamic-umalqura>, C<islamicc>, C<iso8601>, C<japanese>, C<persian>, C<roc>
6139              
6140             =item * C<locale>
6141              
6142             A C<locale>, such as C<en> or C<ja-JP> as can be found in table L<locales|/"Table locales">
6143              
6144             =back
6145              
6146             See also the method L<l10n|/l10n>
6147              
6148             =head2 calendar_era_l10n
6149              
6150             my $ref = $cldr->calendar_era_l10n(
6151             locale => 'ja',
6152             calendar => 'gregorian',
6153             era_width => 'abbreviated',
6154             alt => undef,
6155             era_id => 0,
6156             );
6157             # Returns an hash reference like this:
6158             {
6159             cal_era_l10n_id => 2844,
6160             locale => 'ja',
6161             calendar => 'gregorian',
6162             era_width => 'abbreviated',
6163             era_id => 0,
6164             alt => undef,
6165             locale_name => '紀元前',
6166             }
6167              
6168             Returns an hash reference of a calendar era information from the table L<calendar_eras_l10n|/"Table calendar_eras_l10n"> for a given C<calendar> value, a C<locale>, a C<era_width>, and a C<era_id>. If no C<alt> value is provided, it will default to C<undef>
6169              
6170             The meaning of the fields are as follows:
6171              
6172             =over 4
6173              
6174             =item * C<cal_era_l10n_id>
6175              
6176             A unique incremental value automatically generated by SQLite.
6177              
6178             =item * C<locale>
6179              
6180             A C<locale>, such as C<en> or C<ja-JP> as can be found in table L<locales|/"Table locales">
6181              
6182             =item * C<calendar>
6183              
6184             A C<calendar> ID as can be found in the L<table calendars|/"Table calendars">
6185              
6186             Known values used are: C<buddhist>, C<coptic>, C<ethiopic>, C<ethiopic-amete-alem>, C<generic>, C<gregorian>, C<hebrew>, C<indian>, C<islamic>, C<japanese>, C<persian>, C<roc>
6187              
6188             =item * C<era_width>
6189              
6190             An era width.
6191              
6192             Known values are: C<abbreviated>, C<narrow>, C<wide>
6193              
6194             =item * C<era_id>
6195              
6196             A string representing an era ID. This is actually always an integer with minimum value of C<0> and maximum value of C<99>
6197              
6198             =item * C<alt>
6199              
6200             A string to provide an alternative value for an era with the same ID.
6201              
6202             =item * C<locale_name>
6203              
6204             A string providing with a localised name for this era for the current C<locale>
6205              
6206             =back
6207              
6208             =head2 calendar_eras_l10n
6209              
6210             my $array_ref = $cldr->calendar_eras_l10n;
6211             # Filter based on the 'locale' field value
6212             my $array_ref = $cldr->calendar_eras_l10n( locale => 'en' );
6213             # Filter based on the 'calendar' field value
6214             my $array_ref = $cldr->calendar_eras_l10n( calendar => 'gregorian' );
6215             # or a combination of multiple fields:
6216             my $array_ref = $cldr->calendar_eras_l10n(
6217             locale => 'en',
6218             calendar => 'gregorian',
6219             era_width => 'abbreviated',
6220             alt => undef
6221             );
6222              
6223             Returns all calendar localised eras information from L<table calendar_eras_l10n|/"Table calendar_eras_l10n"> as an array reference of hash reference.
6224              
6225             A combination of the following fields may be provided to filter the information returned:
6226              
6227             =over 4
6228              
6229             =item * C<alt>
6230              
6231             The alternative value, if any, which may be C<variant> or C<undef>, i.e., no value.
6232              
6233             =item * C<calendar>
6234              
6235             A C<calendar> ID as can be found in table L<calendars|/"Table calendars">, such as: C<buddhist>, C<chinese>, C<coptic>, C<dangi>, C<ethioaa>, C<ethiopic>, C<gregory>, C<hebrew>, C<indian>, C<islamic>, C<islamic-civil>, C<islamic-rgsa>, C<islamic-tbla>, C<islamic-umalqura>, C<islamicc>, C<iso8601>, C<japanese>, C<persian>, C<roc>
6236              
6237             =item * C<era_width>
6238              
6239             Possible values are: C<abbreviated>, C<narrow>, C<wide>
6240              
6241             =item * C<locale>
6242              
6243             A C<locale>, such as C<en> or C<ja-JP> as can be found in table L<locales|/"Table locales">
6244              
6245             =back
6246              
6247             See also the method L<l10n|/l10n>
6248              
6249             =head2 calendar_format_l10n
6250              
6251             my $ref = $cldr->calendar_format_l10n(
6252             locale => 'ja',
6253             calendar => 'gregorian',
6254             # date, time
6255             format_type => 'date',
6256             # full, long, medium, short
6257             format_length => 'full',
6258             );
6259             # Returns an hash reference like this:
6260             {
6261             cal_fmt_l10n_id => 906,
6262             locale => 'ja',
6263             calendar => 'gregorian',
6264             format_type => 'date',
6265             format_length => 'full',
6266             alt => undef,
6267             format_id => 'yMEEEEd',
6268             format_pattern => 'y年M月d日EEEE',
6269             }
6270              
6271             Returns an hash reference of a calendar format information from the table L<calendar_formats_l10n|/"Table calendar_formats_l10n"> for a given C<calendar> value, a C<locale>, a C<format_type>, and a C<format_length>.
6272              
6273             The meaning of the fields are as follows:
6274              
6275             =over 4
6276              
6277             =item * C<cal_fmt_l10n_id>
6278              
6279             A unique incremental value automatically generated by SQLite.
6280              
6281             =item * C<locale>
6282              
6283             A C<locale>, such as C<en> or C<ja-JP> as can be found in table L<locales|/"Table locales">
6284              
6285             =item * C<calendar>
6286              
6287             A C<calendar> ID as can be found in the L<table calendars|/"Table calendars">
6288              
6289             Known values are: C<buddhist>, C<chinese>, C<coptic>, C<dangi>, C<ethiopic>, C<ethiopic-amete-alem>, C<generic>, C<gregorian>, C<hebrew>, C<indian>, C<islamic>, C<islamic-civil>, C<islamic-rgsa>, C<islamic-tbla>, C<islamic-umalqura>, C<japanese>, C<persian>, C<roc>
6290              
6291             =item * C<format_type>
6292              
6293             A string representing a format type.
6294              
6295             Possible values are: C<date> or C<time>
6296              
6297             =item * C<format_length>
6298              
6299             A string representing a format length.
6300              
6301             Known values are: C<full>, C<long>, C<medium>, C<short>
6302              
6303             =item * C<alt>
6304              
6305             A string to provide an alternative value for a format with the same ID.
6306              
6307             =item * C<format_id>
6308              
6309             A string representing a format ID.
6310              
6311             =item * C<format_pattern>
6312              
6313             A string representing a localised pattern.
6314              
6315             =back
6316              
6317             =head2 calendar_formats_l10n
6318              
6319             my $array_ref = $cldr->calendar_formats_l10n;
6320             # Filter based on the 'locale' field value
6321             my $array_ref = $cldr->calendar_formats_l10n( locale => 'en' );
6322             # Filter based on the 'calendar' field value
6323             my $array_ref = $cldr->calendar_formats_l10n( calendar => 'gregorian' );
6324             # or a combination of multiple fields:
6325             my $array_ref = $cldr->calendar_formats_l10n(
6326             locale => 'en',
6327             calendar => 'gregorian',
6328             format_type => 'date',
6329             format_length => 'full',
6330             );
6331              
6332             Returns all calendar localised date and time formats information from L<table calendar_formats_l10n|/"Table calendar_formats_l10n"> as an array reference of hash reference.
6333              
6334             A combination of the following fields may be provided to filter the information returned:
6335              
6336             =over 4
6337              
6338             =item * C<calendar>
6339              
6340             A C<calendar> ID as can be found in table L<calendars|/"Table calendars">, such as: C<buddhist>, C<chinese>, C<coptic>, C<dangi>, C<ethioaa>, C<ethiopic>, C<gregory>, C<hebrew>, C<indian>, C<islamic>, C<islamic-civil>, C<islamic-rgsa>, C<islamic-tbla>, C<islamic-umalqura>, C<islamicc>, C<iso8601>, C<japanese>, C<persian>, C<roc>
6341              
6342             =item * C<format_length>
6343              
6344             Possible values are: C<full>, C<long>, C<medium>, C<short>
6345              
6346             =item * C<format_type>
6347              
6348             The format type, which may be C<date> or C<time>
6349              
6350             =item * C<locale>
6351              
6352             A C<locale>, such as C<en> or C<ja-JP> as can be found in table L<locales|/"Table locales">
6353              
6354             =back
6355              
6356             See also the method L<l10n|/l10n>
6357              
6358             =head2 calendar_interval_format
6359              
6360             my $ref = $cldr->calendar_interval_format(
6361             locale => 'en',
6362             calendar => 'gregorian',
6363             greatest_diff_id => 'd',
6364             format_id => 'GyMMMEd',
6365             alt => undef,
6366             );
6367             # Returns an hash reference like this:
6368             {
6369             cal_int_fmt_id => 3846,
6370             locale => 'en',
6371             calendar => 'gregorian',
6372             format_id => 'GyMMMEd',
6373             greatest_diff_id => 'd',
6374             format_pattern => 'E, MMM d – E, MMM d, y G',
6375             alt => undef,
6376             part1 => 'E, MMM d',
6377             separator => ' – ',
6378             part2 => 'E, MMM d, y G',
6379             repeating_field => 'E, MMM d',
6380             }
6381              
6382             Returns an hash reference of a C<calendar> localised interval information from the table L<calendar_interval_formats|/"Table calendar_interval_formats"> for a given C<calendar> ID and a C<locale> ID. If no C<alt> value is provided, it will default to C<undef>
6383              
6384             Pay particular attention to the fields C<part1>, C<separator> and C<part2> that are designed to greatly make it easy for you to format and use the interval format pattern.
6385              
6386             Without those special fields, it would not be possible to properly format an interval.
6387              
6388             The meaning of the fields are as follows:
6389              
6390             =over 4
6391              
6392             =item * C<cal_int_fmt_id>
6393              
6394             A unique incremental value automatically generated by SQLite.
6395              
6396             =item * C<locale>
6397              
6398             A C<locale>, such as C<en> or C<ja-JP> as can be found in table L<locales|/"Table locales">
6399              
6400             =item * C<calendar>
6401              
6402             A C<calendar> ID as can be found in the L<table calendars|/"Table calendars">
6403              
6404             Known values are: C<buddhist>, C<chinese>, C<coptic>, C<dangi>, C<ethiopic>, C<ethiopic-amete-alem>, C<generic>, C<gregorian>, C<hebrew>, C<indian>, C<islamic>, C<islamic-civil>, C<islamic-rgsa>, C<islamic-tbla>, C<islamic-umalqura>, C<japanese>, C<persian>, C<roc>
6405              
6406             =item * C<format_id>
6407              
6408             A string representing a format ID.
6409              
6410             =item * C<greatest_diff_id>
6411              
6412             A string representing an ID, itself representing the L<interval greatest difference|https://unicode.org/reports/tr35/tr35-dates.html#intervalFormats>
6413              
6414             =item * C<format_pattern>
6415              
6416             A string representing a localised pattern.
6417              
6418             =item * C<alt>
6419              
6420             A string representing an alternative value.
6421              
6422             =item * C<part1>
6423              
6424             This is the first part of the interval format.
6425              
6426             =item * C<separator>
6427              
6428             This is the string representing the separator between the first and second part.
6429              
6430             =item * C<part2>
6431              
6432             This is the second part of the interval format.
6433              
6434             =item * C<repeating_field>
6435              
6436             This is the repeating field that was computed when building this database.
6437              
6438             This, along with the C<part1>, C<separator> and C<part2> are designed to make it easier for you to format the interval.
6439              
6440             =back
6441              
6442             See L<LDML specifications|https://unicode.org/reports/tr35/tr35-dates.html#intervalFormats> for more information.
6443              
6444             =head2 calendar_interval_formats
6445              
6446             my $array_ref = $cldr->calendar_interval_formats;
6447             # Filter based on the 'locale' field value
6448             my $array_ref = $cldr->calendar_interval_formats( locale => 'en' );
6449             # Filter based on the 'calendar' field value
6450             my $array_ref = $cldr->calendar_interval_formats( calendar => 'gregorian' );
6451             # or a combination of those two:
6452             my $array_ref = $cldr->calendar_interval_formats(
6453             locale => 'en',
6454             calendar => 'gregorian',
6455             );
6456              
6457             Returns all calendar interval formats information from L<table calendar_interval_formats|/"Table calendar_interval_formats"> as an array reference of hash reference.
6458              
6459             A combination of the following fields may be provided to filter the information returned:
6460              
6461             =over 4
6462              
6463             =item * C<calendar>
6464              
6465             A C<calendar> ID as can be found in table L<calendars|/"Table calendars">, such as: C<buddhist>, C<chinese>, C<coptic>, C<dangi>, C<ethioaa>, C<ethiopic>, C<gregory>, C<hebrew>, C<indian>, C<islamic>, C<islamic-civil>, C<islamic-rgsa>, C<islamic-tbla>, C<islamic-umalqura>, C<islamicc>, C<iso8601>, C<japanese>, C<persian>, C<roc>
6466              
6467             =item * C<locale>
6468              
6469             A C<locale>, such as C<en> or C<ja-JP> as can be found in table L<locales|/"Table locales">
6470              
6471             =item * C<greatest_diff_id>
6472              
6473             A string representing an ID, itself representing the L<interval greatest difference|https://unicode.org/reports/tr35/tr35-dates.html#intervalFormats>
6474              
6475             =back
6476              
6477             See also the method L<l10n|/l10n>
6478              
6479             =head2 calendar_l10n
6480              
6481             my $ref = $cldr->calendar_l10n(
6482             locale => 'en',
6483             caendar => 'japanese',
6484             );
6485             # Returns an hash reference like:
6486             {
6487             calendar_l10n_id => 506,
6488             locale => 'en',
6489             calendar => 'japanese',
6490             locale_name => 'Japanese Calendar',
6491             }
6492              
6493             Returns an hash reference of a calendar localised information from the table L<calendars_l10n|/"Table calendars_l10n"> for a given C<locale> ID, and C<calendar> ID.
6494              
6495             The meaning of the fields are as follows:
6496              
6497             =over 4
6498              
6499             =item * C<calendar_l10n_id>
6500              
6501             A unique incremental value automatically generated by SQLite.
6502              
6503             =item * C<locale>
6504              
6505             A C<locale>, such as C<en> or C<ja-JP> as can be found in table L<locales|/"Table locales">
6506              
6507             =item * C<calendar>
6508              
6509             A C<calendar> ID as can be found in the L<table calendars|/"Table calendars">
6510              
6511             Known values are: C<buddhist>, C<chinese>, C<coptic>, C<dangi>, C<ethiopic>, C<ethiopic-amete-alem>, C<generic>, C<gregorian>, C<hebrew>, C<indian>, C<islamic>, C<islamic-civil>, C<islamic-rgsa>, C<islamic-tbla>, C<islamic-umalqura>, C<japanese>, C<persian>, C<roc>
6512              
6513             =item * C<locale_name>
6514              
6515             A string representing the localised name of the calendar.
6516              
6517             =back
6518              
6519             =head2 calendars_l10n
6520              
6521             my $all = $cldr->calendars_l10n;
6522             my $all = $cldr->calendars_l10n(
6523             locale => 'en',
6524             );
6525              
6526             Returns all calendar localised information from L<table calendars_l10n|/"Table calendars_l10n"> as an array reference of hash reference.
6527              
6528             A combination of the following fields may be provided to filter the information returned:
6529              
6530             =over 4
6531              
6532             =item * C<locale>
6533              
6534             A C<locale>, such as C<en> or C<ja-JP> as can be found in table L<locales|/"Table locales">
6535              
6536             =back
6537              
6538             =head2 calendar_term
6539              
6540             my $ref = $cldr->calendar_term(
6541             locale => 'und',
6542             calendar => 'gregorian',
6543             # format, stand-alone
6544             term_context => 'format',
6545             # abbreviated, narrow, wide
6546             term_width => 'abbreviated',
6547             term_name => 'am',
6548             );
6549             # Returns an hash reference like:
6550             {
6551             cal_term_id => 23478,
6552             locale => 'und',
6553             calendar => 'gregorian',
6554             term_type => 'day_period',
6555             term_context => 'format',
6556             term_width => 'abbreviated',
6557             alt => undef,
6558             yeartype => undef,
6559             term_name => 'am',
6560             term_value => 'AM',
6561             }
6562              
6563             Returns an hash reference of a calendar term information from the table L<calendar_terms|/"Table calendar_terms"> for a given C<locale>, C<calendar>, C<term_context>, C<term_width>, C<term_name> value, C<alt> and C<yeartype> value. If no C<alt> or C<yeartype> value is provided, it will default to C<undef>
6564              
6565             You can also query for multiple value at the same time, and this will return an array reference of hash reference instead:
6566              
6567             my $all = $cldr->calendar_term(
6568             locale => 'und',
6569             calendar => 'gregorian',
6570             # format, stand-alone
6571             term_context => 'format',
6572             # abbreviated, narrow, wide
6573             term_width => 'abbreviated',
6574             term_name => [qw( am pm )],
6575             );
6576             # Returns an array reference like:
6577             [
6578             {
6579             cal_term_id => 23478,
6580             locale => 'und',
6581             calendar => 'gregorian',
6582             term_type => 'day_period',
6583             term_context => 'format',
6584             term_width => 'abbreviated',
6585             alt => undef,
6586             yeartype => undef,
6587             term_name => 'am',
6588             term_value => 'AM',
6589             },
6590             {
6591             cal_term_id => 23479,
6592             locale => 'und',
6593             calendar => 'gregorian',
6594             term_type => 'day_period',
6595             term_context => 'format',
6596             term_width => 'abbreviated',
6597             alt => undef,
6598             yeartype => undef,
6599             term_name => 'pm',
6600             term_value => 'PM',
6601             },
6602             ]
6603              
6604             See the section on L</"Advanced Search"> for more information.
6605              
6606             The meaning of the fields are as follows:
6607              
6608             =over 4
6609              
6610             =item * C<cal_term_id>
6611              
6612             A unique incremental value automatically generated by SQLite.
6613              
6614             =item * C<locale>
6615              
6616             A C<locale>, such as C<en> or C<ja-JP> as can be found in table L<locales|/"Table locales">
6617              
6618             =item * C<calendar>
6619              
6620             A C<calendar> ID as can be found in the L<table calendars|/"Table calendars">
6621              
6622             Known values are: C<buddhist>, C<chinese>, C<coptic>, C<dangi>, C<ethiopic>, C<ethiopic-amete-alem>, C<generic>, C<gregorian>, C<hebrew>, C<indian>, C<islamic>, C<islamic-civil>, C<islamic-rgsa>, C<islamic-tbla>, C<islamic-umalqura>, C<japanese>, C<persian>, C<roc>
6623              
6624             =item * C<term_type>
6625              
6626             A string representing a term type.
6627              
6628             Known values are: C<day>, C<day_period>, C<month>, C<quarter>
6629              
6630             =item * C<term_context>
6631              
6632             A string representing a term context.
6633              
6634             Known values are: C<format>, C<stand-alone>
6635              
6636             =item * C<term_width>
6637              
6638             A string representing a term width.
6639              
6640             Known values are: C<abbreviated>, C<narrow>, C<short>, C<wide>
6641              
6642             =item * C<alt>
6643              
6644             A string to provide an alternate representation of a term.
6645              
6646             =item * C<yeartype>
6647              
6648             A string to provide an alternate representation of a term when this is a leap year.
6649              
6650             The usual value for this is C<leap>
6651              
6652             =item * C<term_name>
6653              
6654             A string representing a term name.
6655              
6656             Known values are: C<1>, C<2>, C<3>, C<4>, C<5>, C<6>, C<7>, C<8>, C<9>, C<10>, C<11>, C<12>, C<13>, C<afternoon1>, C<afternoon2>, C<evening1>, C<evening2>, C<midnight>, C<morning1>, C<morning2>, C<night1>, C<night2>, C<noon>, C<am>, C<pm>, C<mon>, C<tue>, C<wed>, C<thu>, C<fri>, C<sat>, C<sun>
6657              
6658             =item * C<term_value>
6659              
6660             A string representing the term value.
6661              
6662             =back
6663              
6664             See also the L<Unicode LDMD specifications|https://unicode.org/reports/tr35/tr35-dates.html#months_days_quarters_eras>
6665              
6666             =head2 calendar_terms
6667              
6668             my $array_ref = $cldr->calendar_terms;
6669             my $array_ref = $cldr->calendar_terms(
6670             locale => 'und',
6671             calendar => 'japanese'
6672             );
6673             my $array_ref = $cldr->calendar_terms(
6674             locale => 'und',
6675             calendar => 'gregorian',
6676             term_type => 'day',
6677             term_context => 'format',
6678             term_width => 'abbreviated',
6679             );
6680              
6681             Returns all calendar terms information from L<table calendar_terms|/"Table calendar_terms"> as an array reference of hash reference.
6682              
6683             A combination of the following fields may be provided to filter the information returned:
6684              
6685             =over 4
6686              
6687             =item * C<calendar>
6688              
6689             A C<calendar> ID as can be found in table L<calendars|/"Table calendars">, such as: C<buddhist>, C<chinese>, C<coptic>, C<dangi>, C<ethioaa>, C<ethiopic>, C<gregory>, C<hebrew>, C<indian>, C<islamic>, C<islamic-civil>, C<islamic-rgsa>, C<islamic-tbla>, C<islamic-umalqura>, C<islamicc>, C<iso8601>, C<japanese>, C<persian>, C<roc>
6690              
6691             =item * C<locale>
6692              
6693             A C<locale>, such as C<en> or C<ja-JP> as can be found in table L<locales|/"Table locales">
6694              
6695             =back
6696              
6697             See also the L<Unicode LDMD specifications|https://unicode.org/reports/tr35/tr35-dates.html#months_days_quarters_eras>
6698              
6699             =head2 casing
6700              
6701             my $ref = $cldr->casing( locale => 'fr', token => 'currencyName' );
6702             # Returns an hash reference like:
6703             {
6704             casing_id => 926,
6705             locale => 'fr',
6706             token => 'currencyName',
6707             value => 'lowercase',
6708             }
6709              
6710             Returns an hash reference of a calendar information from the table L<casings|/"Table casings"> for a given C<token> value.
6711              
6712             The meaning of the fields are as follows:
6713              
6714             =over 4
6715              
6716             =item * C<casing_id>
6717              
6718             A unique incremental value automatically generated by SQLite.
6719              
6720             =item * C<locale>
6721              
6722             A C<locale>, such as C<en> or C<ja-JP> as can be found in table L<locales|/"Table locales">
6723              
6724             =item * C<token>
6725              
6726             Known values are: C<calendar_field>, C<currencyName>, C<currencyName_count>, C<day_format_except_narrow>, C<day_narrow>, C<day_standalone_except_narrow>, C<era_abbr>, C<era_name>, C<era_narrow>, C<key>, C<keyValue>, C<language>, C<metazone_long>, C<month_format_except_narrow>, C<month_narrow>, C<month_standalone_except_narrow>, C<quarter_abbreviated>, C<quarter_format_wide>, C<quarter_narrow>, C<quarter_standalone_wide>, C<relative>, C<script>, C<symbol>, C<territory>, C<unit_pattern>, C<variant>, C<zone_exemplarCity>, C<zone_long>, C<zone_short>
6727              
6728             =item * C<value>
6729              
6730             A casing value.
6731              
6732             =back
6733              
6734             =head2 casings
6735              
6736             my $all = $cldr->casings;
6737             my $all = $cldr->casings( locale => 'fr' );
6738              
6739             Returns all casing information from L<table casings|/"Table casings"> as an array reference of hash reference.
6740              
6741             A combination of the following fields may be provided to filter the information returned:
6742              
6743             =over 4
6744              
6745             =item * C<locale>
6746              
6747             A C<locale>, such as C<en> or C<ja-JP> as can be found in table L<locales|/"Table locales">
6748              
6749             =back
6750              
6751             =head2 cldr_built
6752              
6753             my $datetime = $cldr->cldr_built; # 2024-07-01T05:57:29
6754              
6755             Return the ISO8601 datetime in GMT of when this data were built.
6756              
6757             Note, this is just a string, not a L<DateTime> object. If you want a L<DateTime> object, maybe do something like:
6758              
6759             use DateTime::Format::Strptime;
6760             my $fmt = DateTime::Format::Strptime->new( pattern => '%FT%T' );
6761             my $dt = $fmt->parse_datetime( $cldr->cldr_built );
6762              
6763             =head2 cldr_maintainer
6764              
6765             my $str = $cldr->cldr_maintainer; # Jacques Deguest
6766              
6767             Returns a string representing the name of the person who created this SQLite database of C<CLDR> data.
6768              
6769             =head2 cldr_version
6770              
6771             my $version = $cldr->cldr_version; # 45.0
6772              
6773             Return the Unicode CLDR version number of the data.
6774              
6775             Note, this is just a string. You may want to turn it into an object for comparison, such as:
6776              
6777             use version;
6778             my $vers = version->parse( $cldr->cldr_version );
6779              
6780             Or, maybe:
6781              
6782             use Changes::Version;
6783             my $vers = Changes::Version->new( $cldr->cldr_version );
6784              
6785             say $vers > $other_version;
6786              
6787             =head2 code_mapping
6788              
6789             my $ref = $cldr->code_mapping( code => 'US' );
6790             # Returns an hash reference like:
6791             {
6792             code_mapping_id => 263,
6793             code => 'US',
6794             alpha3 => 'USA',
6795             numeric => 840,
6796             fips10 => undef,
6797             type => 'territory',
6798             }
6799              
6800             Returns an hash reference of a code mapping information from the table L<code_mappings|/"Table code_mappings"> for a given C<code> value.
6801              
6802             The meaning of the fields are as follows:
6803              
6804             =over 4
6805              
6806             =item * C<code_mapping_id>
6807              
6808             A unique incremental value automatically generated by SQLite.
6809              
6810             =item * C<code>
6811              
6812             A C<code> for which there is a mapping with other American standards
6813              
6814             =item * C<alpha3>
6815              
6816             A 3-characters code
6817              
6818             =item * C<numeric>
6819              
6820             A numeric code
6821              
6822             =item * C<fips10>
6823              
6824             An American standard
6825              
6826             =item * C<type>
6827              
6828             The mapping C<type>
6829              
6830             =back
6831              
6832             =head2 code_mappings
6833              
6834             my $all = $cldr->code_mappings;
6835             my $all = $cldr->code_mappings( type => 'territory' );
6836             my $all = $cldr->code_mappings( type => 'currency' );
6837             my $all = $cldr->code_mappings( alpha3 => 'USA' );
6838             my $all = $cldr->code_mappings( numeric => 840 ); # U.S.A.
6839             my $all = $cldr->code_mappings( fips => 'JP' ); # Japan
6840             my $all = $cldr->code_mappings( fips => undef, type => 'currency' );
6841              
6842             Returns all code mapping information from L<table code_mappings|/"Table code_mappings"> as an array reference of hash reference.
6843              
6844             A combination of the following fields may be provided to filter the information returned:
6845              
6846             =over 4
6847              
6848             =item * C<alpha3>
6849              
6850             A 3-characters code.
6851              
6852             =item * C<fips>
6853              
6854             A C<fips> (U.S. L<Federal Information Processing Standard|https://en.wikipedia.org/wiki/Federal_Information_Processing_Standards>) code
6855              
6856             =item * C<numeric>
6857              
6858             An integer code.
6859              
6860             =item * C<type>
6861              
6862             A C<type>, such as C<territory> or C<currency>
6863              
6864             =back
6865              
6866             =head2 collation
6867              
6868             my $ref = $cldr->collation(
6869             collation => 'ducet',
6870             );
6871             # Returns an hash reference like this:
6872             {
6873             collation => 'ducet',
6874             description => 'Dictionary style ordering (such as in Sinhala)',
6875             }
6876              
6877             Returns an hash reference of a C<collation> information from the table L<collations|/"Table collations"> for a given C<collation> ID.
6878              
6879             The meaning of the fields are as follows:
6880              
6881             =over 4
6882              
6883             =item * C<collation>
6884              
6885             A string representing a C<collation> ID.
6886              
6887             Known values are: C<big5han>, C<compat>, C<dict>, C<direct>, C<ducet>, C<emoji>, C<eor>, C<gb2312>, C<phonebk>, C<phonetic>, C<pinyin>, C<reformed>, C<search>, C<searchjl>, C<standard>, C<stroke>, C<trad>, C<unihan>, C<zhuyin>
6888              
6889             =item * C<description>
6890              
6891             A short text describing the collation.
6892              
6893             =back
6894              
6895             =head2 collations
6896              
6897             my $all = $cldr->collations;
6898             my $all = $cldr->collations( collation => 'ducet' );
6899             my $all = $cldr->collations( description => qr/Chinese/ );
6900              
6901             Returns all collations information from L<table collations|/"Table collations"> as an array reference of hash reference.
6902              
6903             A combination of the following fields may be provided to filter the information returned:
6904              
6905             =over 4
6906              
6907             =item * C<collation>
6908              
6909             A C<collation> ID
6910              
6911             =item * C<description>
6912              
6913             A short text describing the collation.
6914              
6915             See the section on L</"Advanced Search">
6916              
6917             =back
6918              
6919             =head2 collation_l10n
6920              
6921             my $ref = $cldr->collation_l10n(
6922             collation => 'ducet',
6923             locale => 'en',
6924             );
6925             # Returns an hash reference like this:
6926             {
6927             collation_l10n_id => 323,
6928             locale => 'en',
6929             collation => 'ducet',
6930             locale_name => 'Default Unicode Sort Order',
6931             }
6932              
6933             Returns an hash reference of a C<collation> localised information from the table L<collations_l10n|/"Table collations_l10n"> for a given C<collation> ID and a C<locale> ID.
6934              
6935             The meaning of the fields are as follows:
6936              
6937             =over 4
6938              
6939             =item * C<collation_l10n_id>
6940              
6941             A unique incremental value automatically generated by SQLite.
6942              
6943             =item * C<locale>
6944              
6945             A C<locale>, such as C<en> or C<ja-JP> as can be found in table L<locales|/"Table locales">
6946              
6947             =item * C<collation>
6948              
6949             A C<collation> ID as can be found in table L<collations|/"Table collations">
6950              
6951             =item * C<locale_name>
6952              
6953             A short text representing the localised C<collation> name.
6954              
6955             =back
6956              
6957             =head2 collations_l10n
6958              
6959             my $all = $cldr->collations_l10n;
6960             my $all = $cldr->collations_l10n( locale => 'en' );
6961             my $all = $cldr->collations_l10n(
6962             locale => 'en',
6963             collation => 'ducet',
6964             );
6965              
6966             Returns all collations information from L<table collations_l10n|/"Table collations_l10n"> as an array reference of hash reference.
6967              
6968             A combination of the following fields may be provided to filter the information returned:
6969              
6970             =over 4
6971              
6972             =item * C<locale>
6973              
6974             A C<locale>, such as C<en> or C<ja-JP> as can be found in table L<locales|/"Table locales">
6975              
6976             =item * C<collation>
6977              
6978             A C<collation> ID as can be found in table L<collations|/"Table collations">
6979              
6980             =back
6981              
6982             =head2 currency
6983              
6984             my $ref = $cldr->currency( currency => 'JPY' ); # Japanese Yen
6985             # Returns an hash reference like:
6986             {
6987             currency_id => 133,
6988             currency => 'JPY',
6989             digits => 0,
6990             rounding => 0,
6991             cash_digits => undef,
6992             cash_rounding => undef,
6993             is_obsolete => 0,
6994             status => 'regular',
6995             }
6996              
6997             Returns an hash reference of a code mapping information from the table L<currencies|/"Table currencies"> for a given C<currency> code.
6998              
6999             The meaning of the fields are as follows:
7000              
7001             =over 4
7002              
7003             =item * C<currency_id>
7004              
7005             A unique incremental value automatically generated by SQLite.
7006              
7007             =item * C<currency>
7008              
7009             A C<currency> code
7010              
7011             =item * C<digits>
7012              
7013             Number of fractional digits.
7014              
7015             =item * C<rounding>
7016              
7017             Number of digits used for rounding.
7018              
7019             =item * C<cash_digits>
7020              
7021             Number of fractional digits for money representation.
7022              
7023             =item * C<cash_rounding>
7024              
7025             Number of digits used for rounding for money representation.
7026              
7027             =item * C<is_obsolete>
7028              
7029             A boolean defining whether the currency is obsolete.
7030              
7031             =item * C<status>
7032              
7033             A string representing the status for this currency.
7034              
7035             Known values are: C<deprecated>, C<regular>, C<unknown>
7036              
7037             =back
7038              
7039             =head2 currencies
7040              
7041             my $all = $cldr->currencies;
7042             my $all = $cldr->currencies( is_obsolete => 1 );
7043              
7044             Returns all currencies information from L<table currencies|/"Table currencies"> as an array reference of hash reference.
7045              
7046             A combination of the following fields may be provided to filter the information returned:
7047              
7048             =over 4
7049              
7050             =item * C<is_obsolete>
7051              
7052             A boolean value. Use 1 for C<true> and 0 for C<false>
7053              
7054             =item * C<status>
7055              
7056             Valid C<status> values are, as per the CLDR:
7057              
7058             =over 8
7059              
7060             =item * C<regular>
7061              
7062             This is the default and means the currency is valid.
7063              
7064             =item * C<deprecated>
7065              
7066             The currency is deprecated.
7067              
7068             =item * C<unknown>
7069              
7070             The status is unknown.
7071              
7072             =back
7073              
7074             =back
7075              
7076             =head2 currency_info
7077              
7078             my $ref = $cldr->currency_info(
7079             currency => 'EUR',
7080             territory' => 'FR',
7081             );
7082             # Returns an hash reference like this:
7083             {
7084             currency_info_id => 165,
7085             territory => 'FR',
7086             currency => 'EUR',
7087             start => '1999-01-01',
7088             until => undef,
7089             is_tender => 0,
7090             hist_sequence => undef,
7091             is_obsolete => 0,
7092             }
7093              
7094             Returns an hash reference of a C<currency> information from the table L<currencies_info|/"Table currencies_infos"> for a given ]C<locale> ID.
7095              
7096             The meaning of the fields are as follows:
7097              
7098             =over 4
7099              
7100             =item * C<currency_info_id>
7101              
7102             A unique incremental value automatically generated by SQLite.
7103              
7104             =item * C<territory>
7105              
7106             A 2-to-3 characters string representing the territory code, which may be either 2-characters uppercase alphabet, or 3-digits code representing a world region.
7107              
7108             =item * C<currency>
7109              
7110             A 3-characters currency code.
7111              
7112             =item * C<start>
7113              
7114             The date at which this currency started to be in use for this C<territory>.
7115              
7116             =item * C<until>
7117              
7118             The date at which this currency stopped being in use for this C<territory>.
7119              
7120             =item * C<is_tender>
7121              
7122             Whether this currency was a legal tender, i.e. whether it bore the force of law to settle a public or private debt or meet a financial obligation.
7123              
7124             =item * C<hist_sequence>
7125              
7126             Integer representing the historical order. C<CLDR> uses the attributes C<tz> and then C<to-tz> to link to following historical record when the old C<to> date overlaps the new C<from> date. Example: territory C<SX>
7127              
7128             =item * C<is_obsolete>
7129              
7130             A boolean value expressing whether this currency is obsolete or not.
7131              
7132             =back
7133              
7134             See the L<LDML specifications|https://www.unicode.org/reports/tr35/tr35-61/tr35-numbers.html#Supplemental_Currency_Data> for more information.
7135              
7136             =head2 currencies_info
7137              
7138             my $all = $cldr->currencies_info;
7139             my $all = $cldr->currencies_info( territory => 'FR' );
7140             my $all = $cldr->currencies_info( currency => 'EUR' );
7141              
7142             Returns all currencies information from L<table currencies_info|/"Table currencies_info"> as an array reference of hash reference.
7143              
7144             A combination of the following fields may be provided to filter the information returned:
7145              
7146             =over 4
7147              
7148             =item * C<territory>
7149              
7150             A 2-characters code representing a C<territory> as can be found in L<table territories|/"Table territories">
7151              
7152             =item * C<currency>
7153              
7154             A 3-characters code representing a C<currency> as can be found in L<table currencies|/"Table currencies">
7155              
7156             =back
7157              
7158             =head2 currency_l10n
7159              
7160             my $ref = $cldr->currency_l10n(
7161             locale => 'en',
7162             count => undef,
7163             currency => 'JPY',
7164             );
7165             # Returns an hash reference like this:
7166             {
7167             curr_l10n_id => 20924,
7168             locale => 'en',
7169             currency => 'JPY',
7170             count => undef,
7171             locale_name => 'Japanese Yen',
7172             symbol => '¥',
7173             }
7174              
7175             Returns an hash reference of a C<currency> localised information from the table L<currencies_l10n|/"Table currencies_l10n"> for a given C<currency> ID, C<locale> ID and C<count> value. If no C<count> value is provided, it will default to C<undef>
7176              
7177             The meaning of the fields are as follows:
7178              
7179             =over 4
7180              
7181             =item * C<curr_l10n_id>
7182              
7183             A unique incremental value automatically generated by SQLite.
7184              
7185             =item * C<locale>
7186              
7187             A C<locale>, such as C<en> or C<ja-JP> as can be found in table L<locales|/"Table locales">
7188              
7189             =item * C<currency>
7190              
7191             A C<currency> ID as can be found in the L<table currencies|/"Table currencies">
7192              
7193             Note that the values used by the C<CLDR> als includes currencies that are deprecated in ISO 4217 standard.
7194              
7195             =item * C<count>
7196              
7197             A string that specifies a distinctive value.
7198              
7199             Known values are: C<undef>, C<few>, C<many>, C<one>, C<other>, C<two>, C<zero>
7200              
7201             For example, with the C<EUR> C<currency> in C<locale> C<en>, here are the possible C<count> values and its associated localised string representation.
7202              
7203             =over 8
7204              
7205             =item * C<undef>
7206              
7207             Euro
7208              
7209             =item * C<one>
7210              
7211             euro
7212              
7213             =item * C<other>
7214              
7215             euros
7216              
7217             =back
7218              
7219             And here with the C<JPY> C<currency> and C<locale> C<pl>:
7220              
7221             =over 4
7222              
7223             =item * C<undef>
7224              
7225             jen japoński
7226              
7227             =item * C<few>
7228              
7229             jeny japońskie
7230              
7231             =item * C<many>
7232              
7233             jenów japońskich
7234              
7235             =item * C<one>
7236              
7237             jen japoński
7238              
7239             =item * C<other>
7240              
7241             jena japońskiego
7242              
7243             =back
7244              
7245             See the L<LDML specifications about language plural rules|https://unicode.org/reports/tr35/tr35-numbers.html#Language_Plural_Rules> for more information.
7246              
7247             =item * C<locale_name>
7248              
7249             A string representing a localised currency name based on the value of C<locale>.
7250              
7251             =item * C<symbol>
7252              
7253             An optional C<currency> symbol.
7254              
7255             =back
7256              
7257             =head2 currencies_l10n
7258              
7259             my $all = $cldr->currencies_l10n;
7260             my $all = $cldr->currencies_l10n( locale => 'en' );
7261             my $all = $cldr->currencies_l10n(
7262             locale => 'en',
7263             currency => 'JPY',
7264             );
7265              
7266             Returns all currencies localised information from L<table currencies_l10n|/"Table currencies_l10n"> as an array reference of hash reference.
7267              
7268             A combination of the following fields may be provided to filter the information returned:
7269              
7270             =over 4
7271              
7272             =item * C<locale>
7273              
7274             A C<locale>, such as C<en> or C<ja-JP> as can be found in table L<locales|/"Table locales">
7275              
7276             =item * C<count>
7277              
7278             A string representing a distinctive C<count> for the C<currency>
7279              
7280             Known values are: C<undef>, C<few>, C<many>, C<one>, C<other>, C<two>, C<zero>
7281              
7282             See the L<LDML specifications about language plural rules|https://unicode.org/reports/tr35/tr35-numbers.html#Language_Plural_Rules> for more information.
7283              
7284             =item * C<currency>
7285              
7286             A 3-characters C<currency> ID as can be found in the table L<currencies|/"Table currencies">
7287              
7288             =back
7289              
7290             =head2 database_handler
7291              
7292             Returns the current database handler used by the C<Locale::Unicode::Data> object instantiated.
7293              
7294             Please note that the database is opened in read-only. If you want to modify it, which I would advise against, you need to instantiate your own L<DBI> connection. Something like this:
7295              
7296             my $db_file = $cldr->datafile;
7297             $dbh = DBI->connect( "dbi:SQLite:dbname=${db_file}", '', '' ) ||
7298             die( "Unable to make connection to Unicode CLDR SQLite database file ${db_file}: ", $DBI::errstr );
7299             # To enable foreign keys:
7300             # See: <https://metacpan.org/release/ADAMK/DBD-SQLite-1.27/view/lib/DBD/SQLite.pm#Foreign-Keys>
7301             $dbh->do("PRAGMA foreign_keys = ON");
7302              
7303             =head2 datafile
7304              
7305             Sets or gets the file path to the SQLite database file. This defaults to the global variable C<$DB_FILE>
7306              
7307             =head2 date_field_l10n
7308              
7309             my $ref = $cldr->date_field_l10n(
7310             locale => 'en',
7311             field_type => 'day',
7312             field_length => 'narrow',
7313             relative => -1,
7314             );
7315             # Returns an hash reference like this:
7316             {
7317             date_field_id => 2087,
7318             locale => 'en',
7319             field_type => 'day',
7320             field_length => 'narrow',
7321             relative => -1,
7322             locale_name => 'yesterday',
7323             }
7324              
7325             Returns an hash reference of a field localised information from the table L<date_fields_l10n|/"Table date_fields_l10n"> for a given C<locale> ID, C<field_type>, C<field_length> and C<relative> value.
7326              
7327             The meaning of the fields are as follows:
7328              
7329             =over 4
7330              
7331             =item * C<date_field_id>
7332              
7333             A unique incremental value automatically generated by SQLite.
7334              
7335             =item * C<locale>
7336              
7337             A C<locale>, such as C<en> or C<ja-JP> as can be found in table L<locales|/"Table locales">
7338              
7339             =item * C<field_type>
7340              
7341             A string representing a field type.
7342              
7343             Known values are: C<day>, C<fri>, C<hour>, C<minute>, C<mon>, C<month>, C<quarter>, C<sat>, C<second>, C<sun>, C<thu>, C<tue>, C<wed>, C<week>, C<year>
7344              
7345             =item * C<field_length>
7346              
7347             A string representing a field length.
7348              
7349             Known values are: C<narrow>, C<short>, C<standard>
7350              
7351             =item * C<relative>
7352              
7353             An integer representing the relative value of the field. For example, C<0> being today, C<-1> being a day period preceding the current one, and C<1> being a day period following the current one.
7354              
7355             Known values are: C<-2>, C<-1>, C<0>, C<1>, C<2>, C<3>
7356              
7357             =item * C<locale_name>
7358              
7359             A string containing the localised date field based on the C<locale>
7360              
7361             =back
7362              
7363             See the L<LDML specifications|https://unicode.org/reports/tr35/tr35-dates.html#Calendar_Fields> for more information.
7364              
7365             =head2 date_fields_l10n
7366              
7367             my $all = $cldr->date_fields_l10n;
7368             my $all = $cldr->date_fields_l10n( locale => 'en' );
7369             my $all = $cldr->date_fields_l10n(
7370             locale => 'en',
7371             field_type => 'day',
7372             field_length => 'narrow',
7373             );
7374              
7375             Returns all date fields localised information from L<table date_fields_l10n|/"Table date_fields_l10n"> as an array reference of hash reference.
7376              
7377             A combination of the following fields may be provided to filter the information returned:
7378              
7379             =over 4
7380              
7381             =item * C<locale>
7382              
7383             A C<locale>, such as C<en> or C<ja-JP> as can be found in table L<locales|/"Table locales">
7384              
7385             =item * C<field_type>
7386              
7387             A string representing a field type.
7388              
7389             Known values are: C<day>, C<fri>, C<hour>, C<minute>, C<mon>, C<month>, C<quarter>, C<sat>, C<second>, C<sun>, C<thu>, C<tue>, C<wed>, C<week>, C<year>
7390              
7391             =item * C<field_length>
7392              
7393             A string representing a field length.
7394              
7395             Known values are: C<narrow>, C<short>, C<standard>
7396              
7397             =back
7398              
7399             =head2 date_term
7400              
7401             my $ref = $cldr->date_term(
7402             locale => 'en',
7403             term_type => 'day',
7404             term_length => 'narrow',
7405             );
7406             # Returns an hash reference like this:
7407             {
7408             date_term_id => 2087,
7409             locale => 'en',
7410             term_type => 'day',
7411             term_length => 'narrow',
7412             display_name => 'day',
7413             }
7414              
7415             Returns an hash reference of a date term localised information from the table L<date_terms|/"Table date_terms"> for a given C<locale> ID, C<term_type>, and C<term_length> value.
7416              
7417             The meaning of the fields are as follows:
7418              
7419             =over 4
7420              
7421             =item * C<date_term_id>
7422              
7423             A unique incremental value automatically generated by SQLite.
7424              
7425             =item * C<locale>
7426              
7427             A C<locale>, such as C<en> or C<ja-JP> as can be found in table L<locales|/"Table locales">
7428              
7429             =item * C<term_type>
7430              
7431             A string representing a field type.
7432              
7433             Known values are: C<day>, C<fri>, C<hour>, C<minute>, C<mon>, C<month>, C<quarter>, C<sat>, C<second>, C<sun>, C<thu>, C<tue>, C<wed>, C<week>, C<year>
7434              
7435             =item * C<term_length>
7436              
7437             A string representing a field length.
7438              
7439             Known values are: C<narrow>, C<short>, C<standard>
7440              
7441             =item * C<display_name>
7442              
7443             The localised string value for the C<term_type>
7444              
7445             For example, C<hour> for the locale C<ja> (Japanese) would be C<時>
7446              
7447             =back
7448              
7449             See the L<LDML specifications|https://unicode.org/reports/tr35/tr35-dates.html#Calendar_Fields> for more information.
7450              
7451             See also the method L<date_field_l10n|/date_field_l10n>
7452              
7453             =head2 date_terms
7454              
7455             my $all = $cldr->date_terms;
7456             my $all = $cldr->date_terms( locale => 'en' );
7457             my $all = $cldr->date_terms(
7458             locale => 'en',
7459             term_type => 'day',
7460             term_length => 'narrow',
7461             );
7462              
7463             Returns all date terms localised information from L<table date_terms|/"Table date_terms"> as an array reference of hash reference.
7464              
7465             A combination of the following fields may be provided to filter the information returned:
7466              
7467             =over 4
7468              
7469             =item * C<locale>
7470              
7471             A C<locale>, such as C<en> or C<ja-JP> as can be found in table L<locales|/"Table locales">
7472              
7473             =item * C<term_type>
7474              
7475             A string representing a field type.
7476              
7477             Known values are: C<day>, C<fri>, C<hour>, C<minute>, C<mon>, C<month>, C<quarter>, C<sat>, C<second>, C<sun>, C<thu>, C<tue>, C<wed>, C<week>, C<year>
7478              
7479             =item * C<term_length>
7480              
7481             A string representing a field length.
7482              
7483             Known values are: C<narrow>, C<short>, C<standard>
7484              
7485             =back
7486              
7487             See also the method L<date_fields_l10n|/date_fields_l10n>
7488              
7489             =head2 day_period
7490              
7491             my $ref = $cldr->day_period( locale => 'fr', day_period => 'noon' );
7492             # Returns an hash reference like:
7493             {
7494             day_period_id => 115,
7495             locale => 'fr',
7496             day_period => 'noon',
7497             start => '12:00',
7498             until => '12:00',
7499             }
7500              
7501             Returns an hash reference of a day period information from the table L<day_periods|/"Table day_periods"> for a given C<locale> code and C<day_period> code.
7502              
7503             The meaning of the fields are as follows:
7504              
7505             =over 4
7506              
7507             =item * C<day_period_id>
7508              
7509             A unique incremental value automatically generated by SQLite.
7510              
7511             =item * C<locale>
7512              
7513             A C<locale>, such as C<en> or C<ja-JP> as can be found in table L<locales|/"Table locales">
7514              
7515             =item * C<day_period>
7516              
7517             A string representing a day period.
7518              
7519             Known values are: C<afternoon1>, C<afternoon2>, C<am>, C<evening1>, C<evening2>, C<midnight>, C<morning1>, C<morning2>, C<night1>, C<night2>, C<noon>, C<pm>
7520              
7521             =item * C<start>
7522              
7523             A time from which this day period starts.
7524              
7525             Known values go from C<00:00> until C<23:00>
7526              
7527             =item * C<until>
7528              
7529             A time by which this day period stops.
7530              
7531             Known values go from C<00:00> until C<24:00>
7532              
7533             =back
7534              
7535             =head2 day_periods
7536              
7537             my $all = $cldr->day_periods;
7538             my $all = $cldr->day_periods( locale => 'ja' );
7539             # Known values for day_period: afternoon1, afternoon2, am, evening1, evening2,
7540             # midnight, morning1, morning2, night1, night2, noon, pm
7541             my $all = $cldr->day_periods( day_period => 'noon' );
7542              
7543             Returns all day periods information from L<table day_periods|/"Table day_periods"> as an array reference of hash reference.
7544              
7545             A combination of the following fields may be provided to filter the information returned:
7546              
7547             =over 4
7548              
7549             =item * C<day_period>
7550              
7551             A token representing a day period. Valid tokens are: C<afternoon1>, C<afternoon2>, C<am>, C<evening1>, C<evening2>, C<midnight>, C<morning1>, C<morning2>, C<night1>, C<night2>, C<noon>, C<pm>
7552              
7553             =item * C<locale>
7554              
7555             A C<locale>, such as C<en> or C<ja-JP> as can be found in table L<locales|/"Table locales">
7556              
7557             =back
7558              
7559             =head2 decode_sql_arrays
7560              
7561             my $bool = $cldr->decode_sql_arrays;
7562             $cldr->decode_sql_arrays(0); # off
7563             $cldr->decode_sql_arrays(1); # on
7564              
7565             Sets or gets the boolean value used to specify whether you want this API to automatically decode SQL arrays into perl arrays using L<JSON::XS>
7566              
7567             This is set to true by default, upon object instantiation.
7568              
7569             =head2 extend_timezones_cities
7570              
7571             my $bool = $cldr->extend_timezones_cities;
7572             $cldr->extend_timezones_cities(0); # off
7573             $cldr->extend_timezones_cities(1); # on
7574              
7575             Sets or gets the boolean value used to specify whether you want to use the time zones cities extended data, if any were added, or not.
7576              
7577             To add the time zones cities extended data, see the Unicode CLDR SQLite database script option C<--extended-timezones-cities>
7578              
7579             Normally, this SQLite database comes by default with an extended set of time zones cities data for 421 time zones and their main city across 88 locales, courtesy of the GeoNames database, and online work the author of this distribution has performed.
7580              
7581             See also the method L<timezone_city|/timezone_city> and L<timezones_cities|/timezones_cities>
7582              
7583             This is set to true by default, upon object instantiation.
7584              
7585             =head2 error
7586              
7587             Used as a mutator, this sets and L<exception object|Locale::Unicode::Exception> and returns an C<Locale::Unicode::NullObject> in object context (such as when chaining), or C<undef> in scalar context, or an empty list in list context.
7588              
7589             The C<Locale::Unicode::NullObject> class prevents the perl error of C<Can't call method "%s" on an undefined value> (see L<perldiag>). Upon the last method chained, C<undef> is returned in scalar context or an empty list in list context.
7590              
7591             For example:
7592              
7593             my $locale = Locale::Unicode->new( 'ja' );
7594             $locale->translation( 'my-software' )->transform_locale( $bad_value )->tz( 'jptyo' ) ||
7595             die( $locale->error );
7596              
7597             In this example, C<jptyo> will never be set, because C<transform_locale> triggered an exception that returned an C<Locale::Unicode::NullObject> object catching all further method calls, but eventually we get the error and die.
7598              
7599             =head2 fatal
7600              
7601             $cldr->fatal(1); # Enable fatal exceptions
7602             $cldr->fatal(0); # Disable fatal exceptions
7603             my $bool = $cldr->fatal;
7604              
7605             Sets or get the boolean value, whether to die upon exception, or not. If set to true, then instead of setting an L<exception object|Locale::Unicode::Data::Exception>, this module will die with an L<exception object|Locale::Unicode::Data::Exception>. You can catch the exception object then after using C<try>. For example:
7606              
7607             use v.5.34; # to be able to use try-catch blocks in perl
7608             use experimental 'try';
7609             no warnings 'experimental';
7610             try
7611             {
7612             my $cldr = Locale::Unicode::Data->new( fatal => 1 );
7613             # Forgot the 'width':
7614             my $str = $cldr->timezone_names( timezone => 'Asia/Tokyo', locale => 'en' );
7615             }
7616             catch( $e )
7617             {
7618             say "Error occurred: ", $e->message;
7619             # Error occurred: No value for width was provided.
7620             }
7621              
7622             =head2 interval_formats
7623              
7624             my $ref = $cldr->interval_formats(
7625             locale => 'en',
7626             calendar => 'gregorian',
7627             );
7628              
7629             This would return something like:
7630              
7631             {
7632             Bh => [qw( B h )],
7633             Bhm => [qw( B h m )],
7634             d => ["d"],
7635             default => ["default"],
7636             Gy => [qw( G y )],
7637             GyM => [qw( G M y )],
7638             GyMd => [qw( d G M y )],
7639             GyMEd => [qw( d G M y )],
7640             GyMMM => [qw( G M y )],
7641             GyMMMd => [qw( d G M y )],
7642             GyMMMEd => [qw( d G M y )],
7643             H => ["H"],
7644             h => [qw( a h )],
7645             hm => [qw( a h m )],
7646             Hm => [qw( H m )],
7647             hmv => [qw( a h m )],
7648             Hmv => [qw( H m )],
7649             Hv => ["H"],
7650             hv => [qw( a h )],
7651             M => ["M"],
7652             Md => [qw( d M )],
7653             MEd => [qw( d M )],
7654             MMM => ["M"],
7655             MMMd => [qw( d M )],
7656             MMMEd => [qw( d M )],
7657             y => ["y"],
7658             yM => [qw( M y )],
7659             yMd => [qw( d M y )],
7660             yMEd => [qw( d M y )],
7661             yMMM => [qw( M y )],
7662             yMMMd => [qw( d M y )],
7663             yMMMEd => [qw( d M y )],
7664             yMMMM => [qw( M y )],
7665             }
7666              
7667             This returns an hash reference of interval format ID with their associated L<greatest difference token|https://unicode.org/reports/tr35/tr35-dates.html#intervalFormats> for the given C<locale> ID and C<calendar> ID.
7668              
7669             The C<default> interval format pattern is something like C<{0} – {1}>, but this changes depending on the C<locale> and is not always available.
7670              
7671             C<{0}> is the placeholder for the first datetime and C<{1}> is the placeholder for the second one.
7672              
7673             =head2 l10n
7674              
7675             Returns all localised information for certain type of data as an array reference of hash reference.
7676              
7677             The following core parameters must be provided:
7678              
7679             =over 4
7680              
7681             =item * C<locale>
7682              
7683             This is mandatory. This is a C<locale>, such as C<en> or C<ja-JP> as can be found in table L<locales|/"Table locales">
7684              
7685             =item * C<type>
7686              
7687             A type of data. Valid types are: C<annotation>, C<calendar_append_format>, C<calendar_available_format>, C<calendar_cyclic>, C<calendar_era>, C<calendar_format>, C<calendar_interval_formats>, C<calendar_term>, C<casing>, C<currency>, C<date_field>, C<locale>, C<number_format>, C<number_symbol>, C<script>, C<subdivision>, C<territory>, C<unit>, C<variant>
7688              
7689             =back
7690              
7691             Below are each type of data and their associated parameters:
7692              
7693             =over 4
7694              
7695             =item * C<annotation>
7696              
7697             my $ref = $cldr->l10n(
7698             type => 'annotation',
7699             locale => 'en',
7700             annotation => '{',
7701             );
7702              
7703             Returns an hash reference of a annotation information from the table L<annotations|/"Table annotations"> for a given C<locale> code and C<annotation> character.
7704              
7705             =item * C<calendar_append_format>
7706              
7707             my $ref = $cldr->l10n(
7708             type => 'calendar_append_format',
7709             locale => 'en',
7710             calendar => 'gregorian',
7711             format_id => 'Day',
7712             );
7713              
7714             Returns an hash reference of a calendar appended format information from the table L<calendar_append_formats|/"Table calendar_append_formats"> for a given C<locale>, and C<calendar> code and a C<format_id> ID.
7715              
7716             =item * C<calendar_available_format>
7717              
7718             my $ref = $cldr->l10n(
7719             type => 'calendar_available_format',
7720             locale => 'ja',
7721             calendar => 'japanese',
7722             format_id => 'GyMMMEEEEd',
7723             );
7724              
7725             Returns an hash reference of a calendar available format information from the table L<calendar_available_formats|/"Table calendar_available_formats"> for a given C<locale>, and C<calendar> code and a C<format_id> ID.
7726              
7727             =item * C<calendar_cyclic>
7728              
7729             my $ref = $cldr->l10n(
7730             type => 'calendar_cyclic',
7731             locale => 'ja',
7732             calendar => 'chinese',
7733             format_set => 'dayParts',
7734             # 1..12
7735             format_id => 1,
7736             );
7737              
7738             Returns an hash reference of a calendar available format information from the table L<calendar_cyclics_l10n|/"Table calendar_cyclics_l10n"> for a given C<locale>, and C<calendar> code and a C<format_set> token and a C<format_id> ID.
7739              
7740             =item * C<calendar_era>
7741              
7742             my $ref = $cldr->l10n(
7743             type => 'calendar_era',
7744             locale => 'ja',
7745             calendar => 'japanese',
7746             # abbreviated, narrow
7747             # 'narrow' contains less data than 'abbreviated'
7748             era_width => 'abbreviated',
7749             era_id => 236,
7750             );
7751              
7752             Returns an hash reference of a calendar available format information from the table L<calendar_eras_l10n|/"Table calendar_eras_l10n"> for a given C<locale>, and C<calendar> code and a C<era_width> width and a C<era_id> ID.
7753              
7754             =item * C<calendar_format>
7755              
7756             my $ref = $cldr->l10n(
7757             type => 'calendar_format',
7758             locale => 'ja',
7759             calendar => 'gregorian',
7760             format_id => 'yMEEEEd',
7761             );
7762              
7763             Returns an hash reference of a calendar date or time format information from the table L<calendar_formats_l10n|/"Table calendar_formats_l10n"> for a given C<locale>, and C<calendar> code and a C<format_id> ID.
7764              
7765             =item * C<calendar_interval_format>
7766              
7767             my $ref = $cldr->l10n(
7768             type => 'calendar_interval_format',
7769             locale => 'ja',
7770             calendar => 'gregorian',
7771             format_id => 'yMMM',
7772             );
7773              
7774             Returns an hash reference of a calendar interval format information from the table L<calendar_interval_formats|/"Table calendar_interval_formats"> for a given C<locale>, and C<calendar> code and a C<format_id> ID.
7775              
7776             =item * C<calendar_term>
7777              
7778             my $ref = $cldr->l10n(
7779             type => 'calendar_term',
7780             locale => 'ja',
7781             calendar => 'gregorian',
7782             term_name => 'mon',
7783             );
7784              
7785             Returns an hash reference of a calendar term information from the table L<calendar_terms|/"Table calendar_terms"> for a given C<locale>, and C<calendar> code and a C<term_name> token.
7786              
7787             Known term names are: C<mon>, C<tue>, C<wed>, C<thu>, C<fri>, C<sat>, C<sun>, C<am>, C<pm>, C<1>, C<2>, C<3>, C<4>, C<5>, C<6>, C<7>, C<8>, C<9>, C<10>, C<11>, C<12>, C<13>, C<midnight>, C<morning1>, C<morning2>, C<noon>, C<afternoon1>, C<afternoon2>, C<evening1>, C<evening2>, C<night1>, C<night2>
7788              
7789             =item * C<casing>
7790              
7791             my $ref = $cldr->l10n(
7792             type => 'casing',
7793             locale => 'fr',
7794             token => 'currencyName',
7795             );
7796              
7797             Returns an hash reference of a casing information from the table L<casings|/"Table casings"> for a given C<locale> code and a C<token>.
7798              
7799             =item * C<currency>
7800              
7801             my $ref = $cldr->l10n(
7802             type => 'currency',
7803             locale => 'ja',
7804             currency => 'EUR',
7805             );
7806              
7807             Returns an hash reference of a currency information from the table L<currencies_l10n|/"Table currencies_l10n"> for a given C<locale> code and a C<currency> code.
7808              
7809             =item * C<date_field>
7810              
7811             my $ref = $cldr->l10n(
7812             type => 'date_field',
7813             locale => 'ja',
7814             # Other possible values:
7815             # day, week, month, quarter, year, hour, minute, second,
7816             # mon, tue, wed, thu, fri, sat, sun
7817             field_type => 'day',
7818             # -1 for yesterday, 0 for today, 1 for tomorrow
7819             relative => -1,
7820             );
7821              
7822             Returns an hash reference of a date field information from the table L<date_fields_l10n|/"Table date_fields_l10n"> for a given C<locale>, and a field type C<field_type> and C<relative> value.
7823              
7824             =item * C<locale>
7825              
7826             my $ref = $cldr->l10n(
7827             type => 'locale',
7828             locale => 'ja',
7829             locale_id => 'fr',
7830             );
7831              
7832             Returns an hash reference of a locale information from the table L<locales_l10n|/"Table locales_l10n"> for a given C<locale>, and a locale ID C<locale_id>.
7833              
7834             =item * C<number_format>
7835              
7836             my $ref = $cldr->l10n(
7837             type => 'number_format',
7838             locale => 'ja',
7839             number_type => 'currency',
7840             format_id => '10000',
7841             );
7842              
7843             Returns an hash reference of a number format from the table L<number_formats_l10n|/"Table number_formats_l10n"> for a given C<locale>, a number type C<number_type>, and a format ID C<format_id>.
7844              
7845             Known value for C<number_type> are: C<currency>, C<decimal>, C<misc>, C<percent>, C<scientific>
7846              
7847             =item * C<number_symbol>
7848              
7849             my $ref = $cldr->l10n(
7850             type => 'number_symbol',
7851             locale => 'en',
7852             number_system => 'latn',
7853             property => 'decimal',
7854             );
7855              
7856             Returns an hash reference of a number symbol information from the table L<number_symbols_l10n|/"Table number_symbols_l10n"> for a given C<locale>, a number system C<number_system> as can be found in the L<table number_systems|/"Table number_systems">, and a C<property> value.
7857              
7858             =item * C<script>
7859              
7860             my $ref = $cldr->l10n(
7861             type => 'script',
7862             locale => 'ja',
7863             script => 'Kore',
7864             );
7865              
7866             Returns an hash reference of a script information from the table L<scripts_l10n|/"Table scripts_l10n"> for a given C<locale>, a script value C<script> as can be found in the L<scripts table|/"Table scripts">.
7867              
7868             =item * C<subdivision>
7869              
7870             my $ref = $cldr->l10n(
7871             type => 'subdivision',
7872             locale => 'en',
7873             subdivision => 'jp13', # Tokyo
7874             );
7875              
7876             Returns an hash reference of a subdivision information from the table L<subdivisions_l10n|/"Table subdivisions_l10n"> for a given C<locale>, a subdivision value C<subdivision> as can be found in the L<subdivisions table|/"Table subdivisions">.
7877              
7878             =item * C<territory>
7879              
7880             my $ref = $cldr->l10n(
7881             type => 'territory',
7882             locale => 'en',
7883             territory => 'JP', # Japan
7884             );
7885              
7886             Returns an hash reference of a territory information from the table L<territories_l10n|/"Table territories_l10n"> for a given C<locale>, and a C<territory> code as can be found in the L<territories table|/"Table territories">.
7887              
7888             =item * C<unit>
7889              
7890             my $ref = $cldr->l10n(
7891             type => 'unit',
7892             locale => 'en',
7893             unit_id => 'power3',
7894             );
7895              
7896             Returns an hash reference of a unit information from the table L<units_l10n|/"Table units_l10n"> for a given C<locale>, and a C<unit_id>.
7897              
7898             =item * C<variant>
7899              
7900             my $ref = $cldr->l10n(
7901             type => 'variant',
7902             locale => 'en',
7903             variant => 'valencia',
7904             );
7905              
7906             Returns an hash reference of a variant information from the table L<variants_l10n|/"Table variants_l10n"> for a given C<locale>, and a C<variant> as can be found in the L<table variants|/"Table variants">.
7907              
7908             =back
7909              
7910             =head2 language
7911              
7912             my $ref = $cldr->language( language => 'ryu' ); # Central Okinawan (Ryukyu)
7913             # Returns an hash reference like this:
7914             {
7915             language_id => 6712,
7916             language => 'ryu',
7917             scripts => ["Kana"],
7918             territories => ["JPY"],
7919             parent => undef,
7920             alt => undef,
7921             status => 'regular',
7922             }
7923              
7924             Returns an hash reference of a C<language> information from the table L<languages|/"Table languages"> for a given C<language> ID.
7925              
7926             The meaning of the fields are as follows:
7927              
7928             =over 4
7929              
7930             =item * C<language_id>
7931              
7932             A unique incremental value automatically generated by SQLite.
7933              
7934             =item * C<language>
7935              
7936             A C<language> ID, which may be 2 to 3-characters long.
7937              
7938             =item * C<scripts>
7939              
7940             An array of C<script> IDs as can be found in the L<table scripts|/"Table scripts">, and that are associated with this C<language>.
7941              
7942             =item * C<territories>
7943              
7944             An array of C<territory> IDs as can be found in the L<table territories|/"Table territories">, and that are associated with this C<language>.
7945              
7946             =item * C<format_pattern>
7947              
7948             A string representing a localised pattern.
7949              
7950             =back
7951              
7952             =head2 languages
7953              
7954             my $all = $cldr->languages;
7955             my $all = $cldr->languages( parent => 'gmw' );
7956              
7957             Returns all languages information from L<table languages|/"Table languages"> as an array reference of hash reference.
7958              
7959             A combination of the following fields may be provided to filter the information returned:
7960              
7961             =over 4
7962              
7963             =item * C<parent>
7964              
7965             A parent C<locale>, such as C<en> or C<ja-JP> as can be found in table L<locales|/"Table locales">
7966              
7967             The C<parent> value is set in 63% of the languages (over 8,700) in the table L<languages|/"Table languages">
7968              
7969             =back
7970              
7971             =head2 language_population
7972              
7973             my $all = $cldr->language_population( territory => 'JP' );
7974             # Returns an array reference of hash references like this:
7975             [
7976             {
7977             language_pop_id => 738,
7978             territory => 'JP',
7979             locale => 'ja',
7980             population_percent => 95,
7981             literacy_percent => undef,
7982             writing_percent => undef,
7983             official_status => 'official',
7984             },
7985             {
7986             language_pop_id => 739,
7987             territory => 'JP',
7988             locale => 'ryu',
7989             population_percent => 0.77,
7990             literacy_percent => undef,
7991             writing_percent => 5,
7992             official_status => undef,
7993             },
7994             {
7995             language_pop_id => 740,
7996             territory => 'JP',
7997             locale => 'ko',
7998             population_percent => 0.52,
7999             literacy_percent => undef,
8000             writing_percent => undef,
8001             official_status => undef,
8002             }
8003             ]
8004              
8005             Returns an array reference of hash references of a C<language> population information from the table L<language_population|/"Table language_population"> for a given C<territory> ID.
8006              
8007             The meaning of the fields are as follows:
8008              
8009             =over 4
8010              
8011             =item * C<language_pop_id>
8012              
8013             A unique incremental value automatically generated by SQLite.
8014              
8015             =item * C<territory>
8016              
8017             A C<territory> code as can be found in the L<table territories|/"Table territories">
8018              
8019             =item * C<locale>
8020              
8021             A C<locale>, such as C<en> or C<ja-JP> as can be found in table L<locales|/"Table locales">
8022              
8023             =item * C<population_percent>
8024              
8025             A percentage of the population as decimal.
8026              
8027             =item * C<literacy_percent>
8028              
8029             A percentage of the population as decimal.
8030              
8031             =item * C<writing_percent>
8032              
8033             A percentage of the population as decimal.
8034              
8035             =item * C<official_status>
8036              
8037             A string representing the official status for this usage of this C<locale> in this C<territory>
8038              
8039             Known values are: C<undef>, C<official>, C<official_regional>, C<de_facto_officia>
8040              
8041             =back
8042              
8043             =head2 language_populations
8044              
8045             my $all = $cldr->language_populations;
8046             my $all = $cldr->language_populations( official_status => 'official' );
8047              
8048             Returns all language population information from L<table language_population|/"Table language_population"> as an array reference of hash reference.
8049              
8050             A combination of the following fields may be provided to filter the information returned:
8051              
8052             =over 4
8053              
8054             =item * C<official_status>
8055              
8056             A status string, such as C<official>, C<official_regional> or C<de_facto_official>
8057              
8058             =back
8059              
8060             =head2 likely_subtag
8061              
8062             my $ref = $cldr->likely_subtag( locale => 'ja' );
8063             # Returns an hash reference like this:
8064             {
8065             likely_subtag_id => 297,
8066             locale => 'ja',
8067             target => 'ja-Jpan-JP',
8068             }
8069              
8070             Returns an hash reference for a likely C<language> information from the table L<likely_subtags|/"Table likely_subtags"> for a given C<locale> ID.
8071              
8072             The meaning of the fields are as follows:
8073              
8074             =over 4
8075              
8076             =item * C<likely_subtag_id>
8077              
8078             A unique incremental value automatically generated by SQLite.
8079              
8080             =item * C<locale>
8081              
8082             A C<locale>, such as C<en> or C<ja-JP> as can be found in table L<locales|/"Table locales">
8083              
8084             =item * C<target>
8085              
8086             A string representing the C<target> C<locale>
8087              
8088             =back
8089              
8090             See the L<LDML specifications|https://unicode.org/reports/tr35/tr35.html#Likely_Subtags> for more information.
8091              
8092             =head2 likely_subtags
8093              
8094             my $all = $cldr->likely_subtags;
8095              
8096             Returns all likely subtag information from L<table likely_subtags|/"Table likely_subtags"> as an array reference of hash reference.
8097              
8098             No additional parameter is needed.
8099              
8100             =head2 locale
8101              
8102             my $ref = $cldr->locale( locale => 'ja' );
8103             # Returns an hash reference like this:
8104             {
8105             locale_id => 3985,
8106             locale => 'ja',
8107             parent => undef,
8108             collations => ["private-kana", "standard", "unihan"],
8109             status => 'regular',
8110             }
8111              
8112             Returns an hash reference of C<locale> information from the table L<locales|/"Table locales"> for a given C<locale> ID.
8113              
8114             The meaning of the fields are as follows:
8115              
8116             =over 4
8117              
8118             =item * C<locale_id>
8119              
8120             A unique incremental value automatically generated by SQLite.
8121              
8122             =item * C<locale>
8123              
8124             A C<locale>, such as C<en> or C<ja-JP> as can be found in table L<locales|/"Table locales">
8125              
8126             =item * C<parent>
8127              
8128             The parent C<locale>, if any.
8129              
8130             =item * C<collations>
8131              
8132             An array of C<collation> ID, such as one can find from the table L<collations|/"Table collations">
8133              
8134             =item * C<status>
8135              
8136             A string representing a status for this C<locale>
8137              
8138             Known values are: C<undef>, C<deprecated>, C<private_use>, C<regular>, C<reserved>, C<special>, C<unknown>
8139              
8140             =back
8141              
8142             =head2 locales
8143              
8144             my $all = $cldr->locales;
8145              
8146             Returns all locale information from L<table locales|/"Table locales"> as an array reference of hash reference.
8147              
8148             A combination of the following fields may be provided to filter the information returned:
8149              
8150             =over 4
8151              
8152             =item * C<status>
8153              
8154             A status string, such as C<deprecated>, C<private_use>, C<regular>, C<reserved>, C<special>, C<unknown> or C<undef> if none is set.
8155              
8156             =back
8157              
8158             =head2 locale_l10n
8159              
8160             my $ref = $cldr->locale_l10n(
8161             locale => 'en',
8162             locale_id => 'ja',
8163             alt => undef,
8164             );
8165             # Returns an hash reference like this:
8166             {
8167             locales_l10n_id => 16746,
8168             locale => 'en',
8169             locale_id => 'ja',
8170             locale_name => 'Japanese',
8171             alt => undef,
8172             }
8173              
8174             Returns an hash reference of C<locale> localised information from the table L<locales_l10n|/"Table locales_l10n"> for a given C<locale> ID and a C<locale_id> ID and an C<alt> value. If no C<alt> value is provided, it will default to C<undef>.
8175              
8176             The C<locale> value is the C<language>, with possibly some additional subtags, in which the information is provided, and the C<locale_id> the C<locale> id whose name will be returned in the language specified by the C<locale> argument.
8177              
8178             Valid locales that can be found in the L<table locales_l10n|/"Table locales_l10n"> are, for example: C<asa>, C<az-Arab> (using a C<script>), C<be-tarask> (using a C<variant>), C<ca-ES-valencia> (using a combination of C<territory> and C<variant>), C<de-AT> (using a C<territory>), C<es-419> (using a C<region> code)
8179              
8180             See L<Locale::Unicode> for more information on locales.
8181              
8182             The meaning of the fields are as follows:
8183              
8184             =over 4
8185              
8186             =item * C<locales_l10n_id>
8187              
8188             A unique incremental value automatically generated by SQLite.
8189              
8190             =item * C<locale>
8191              
8192             A C<locale>, such as C<en> or C<ja-JP> as can be found in table L<locales|/"Table locales">
8193              
8194             =item * C<locale_id>
8195              
8196             A C<locale>, such as C<en> or C<ja-JP> as can be found in table L<locales|/"Table locales">
8197              
8198             =item * C<locale_name>
8199              
8200             A string representing the localised name of the C<locale_id> according to the C<locale> value.
8201              
8202             =back
8203              
8204             =head2 locales_l10n
8205              
8206             my $all = $cldr->locales_l10n;
8207             # Returns an array reference of all locale information in English
8208             my $all = $cldr->locales_l10n( locale => 'en' );
8209             # Returns an array reference of all the way to write 'Japanese' in various languages
8210             # This would typically return an array reference of something like 267 hash reference
8211             my $all = $cldr->locales_l10n( locale_id => 'ja' );
8212             # This is basically the same as with the method locale_l10n()
8213             my $all = $cldr->locales_l10n(
8214             locale => 'en',
8215             locale_id => 'ja',
8216             alt => undef,
8217             );
8218              
8219             Returns all locale localised information from L<table locales_l10n|/"Table locales_l10n"> as an array reference of hash reference.
8220              
8221             A combination of the following fields may be provided to filter the information returned:
8222              
8223             =over 4
8224              
8225             =item * C<alt>
8226              
8227             This is used to differentiate when alternative values exist.
8228              
8229             Known values for C<alt> are C<undef>, i.e. not set, or C<long>, C<menu>, C<secondary>, C<short>, C<variant>
8230              
8231             =item * C<locale>
8232              
8233             A C<locale> such as C<en> or C<ja-JP> as can be found in table L<locales|/"Table locales">
8234              
8235             This is generally more a C<language>, i.e. a 2 or 3-characters code than a C<locale>
8236              
8237             =item * C<locale_id>
8238              
8239             A 2 to 3 characters C<language> ID such as C<en> as can be found in table L<languages|/"Table languages">
8240              
8241             =back
8242              
8243             =head2 locales_info
8244              
8245             my $ref = $cldr->locales_info(
8246             property => 'quotation_start',
8247             locale => 'ja',
8248             );
8249             # Returns an hash reference like this:
8250             {
8251             locales_info_id => 361,
8252             locale => 'ja',
8253             property => 'quotation_start',
8254             value => '「',
8255             }
8256              
8257             Returns an hash reference of C<locale> properties information from the table L<locales_info|/"Table locales_info"> for a given C<locale> ID and a C<property> value.
8258              
8259             The meaning of the fields are as follows:
8260              
8261             =over 4
8262              
8263             =item * C<locales_info_id>
8264              
8265             A unique incremental value automatically generated by SQLite.
8266              
8267             =item * C<locale>
8268              
8269             A C<locale>, such as C<en> or C<ja-JP> as can be found in table L<locales|/"Table locales">
8270              
8271             =item * C<property>
8272              
8273             A string representing a property.
8274              
8275             Known properties are: C<char_orientation>, C<quotation2_end>, C<quotation2_start>, C<quotation_end>, C<quotation_start>, C<yes> and C<no>
8276              
8277             =item * C<value>
8278              
8279             The C<property> value for this C<locale>
8280              
8281             =back
8282              
8283             =head2 locales_infos
8284              
8285             my $all = $cldr->locales_infos;
8286              
8287             Returns all locale properties information from L<table locales_info|/"Table locales_info"> as an array reference of hash reference.
8288              
8289             No additional parameter is needed.
8290              
8291             =head2 locale_number_system
8292              
8293             my $ref = $cldr->locale_number_system( locale => 'ja' );
8294             # Returns an hash reference like this:
8295             {
8296             locale_num_sys_id => 26,
8297             locale => 'ja',
8298             number_system => undef,
8299             native => undef,
8300             traditional => 'jpan',
8301             finance => 'jpanfin',
8302             }
8303              
8304             As a reminder, the numbering system can be explicitly specified with the Unicode BCP47 extension C<nu>. For example:
8305              
8306             =over 4
8307              
8308             =item * C<hi-IN-u-nu-native>
8309              
8310             Explicitly specifying the native digits for numeric formatting in Hindi language.
8311              
8312             =item * C<zh-u-nu-finance>
8313              
8314             Explicitly specifying the appropriate financial numerals in Chinese language.
8315              
8316             =item * C<ta-u-nu-traditio>
8317              
8318             Explicitly specifying the traditional Tamil numerals in Tamil language.
8319              
8320             =item * C<ar-u-nu-latn>
8321              
8322             Explicitly specifying the western digits 0-9 in Arabic language.
8323              
8324             =back
8325              
8326             Returns an hash reference of a given C<locale> number systems available from the table L<locale_number_systems|/"Table locale_number_systems">.
8327              
8328             TLDR; if C<number_system> and C<native> are the same, then it is ok to also use C<latn> as numbering system. When C<traditional> is not available, use C<native>. When C<finance> is not available, use the default C<number_system>
8329              
8330             The meaning of the fields are as follows:
8331              
8332             =over 4
8333              
8334             =item * C<locale_num_sys_id>
8335              
8336             A unique incremental value automatically generated by SQLite.
8337              
8338             =item * C<locale>
8339              
8340             A C<locale>, such as C<en> or C<ja-JP> as can be found in table L<locales|/"Table locales">
8341              
8342             =item * C<number_system>
8343              
8344             A string representing a number system as can be found in the table L<number_systems|/"Table number_systems">, and "used for presentation of numeric quantities in the given locale" (L<LDML specifications|https://unicode.org/reports/tr35/tr35-numbers.html#defaultNumberingSystem>)
8345              
8346             In L<LDML specifications|https://unicode.org/reports/tr35/tr35-numbers.html#defaultNumberingSystem>, this is named C<default>, but C<default> is a reserved keyword in SQL terminology.
8347              
8348             =item * C<native>
8349              
8350             Quoting from the L<LDML specifications|https://unicode.org/reports/tr35/tr35-numbers.html#otherNumberingSystems>: "Defines the L<numbering system|/number_system> used for the native digits, usually defined as a part of the L<script|/script> used to write the language. The C<native> L<numbering system|/number_system> can only be a numeric positional decimal-digit L<numbering system|/number_system>, using digits with General_Category=Decimal_Number. Note: In locales where the C<native> L<numbering system|/number_system> is the default, it is assumed that the L<numbering system|/number_system> C<latn> (Western digits 0-9) is always acceptable, and can be selected using the C<-nu> keyword as part of a L<Unicode locale identifier|/locale>."
8351              
8352             =item * C<traditional>
8353              
8354             Quoting from the L<LDML specifications|https://unicode.org/reports/tr35/tr35-numbers.html#otherNumberingSystems>: "Defines the C<traditional> numerals for a L<locale|/locale>. This L<numbering system|/number_system> may be numeric or algorithmic. If the C<traditional> L<numbering system|/number_system> is not defined, applications should use the C<native> numbering system as a fallback."
8355              
8356             =item * C<finance>
8357              
8358             Quoting from the L<LDML specifications|https://unicode.org/reports/tr35/tr35-numbers.html#otherNumberingSystems>: "Defines the L<numbering system|/number_system> used for financial quantities. This L<numbering system|/number_system> may be numeric or algorithmic. This is often used for ideographic languages such as Chinese, where it would be easy to alter an amount represented in the default numbering system simply by adding additional strokes. If the financial L<numbering system|/number_system> is not specified, applications should use the default L<numbering system|/number_system> as a fallback."
8359              
8360             =back
8361              
8362             =head2 locale_number_systems
8363              
8364             my $all = $cldr->locale_number_systems;
8365              
8366             Returns all locales L<numbering systems|/number_system> information from L<table locale_number_systems|/"Table locale_number_systems"> as an array reference of hash reference.
8367              
8368             No additional parameter is needed.
8369              
8370             =head2 make_inheritance_tree
8371              
8372             This takes a C<locale>, such as C<ja> or C<ja-JP>, or C<es-ES-valencia> and it will return an array reference of L<inheritance tree of locales|https://unicode.org/reports/tr35/tr35.html#Locale_Inheritance>. This means the provided C<locale>'s parent, its grand-parent, etc until it reaches the C<root>, which, under the C<LDML> specifications is defined by C<und>
8373              
8374             For example:
8375              
8376             # Japanese
8377             my $tree = $cldr->make_inheritance_tree( 'ja-JP' );
8378              
8379             produces:
8380              
8381             ['ja-JP', 'ja', 'und']
8382              
8383             However, there are exceptions and the path is not always linear.
8384              
8385             For example:
8386              
8387             # Portugese in France
8388             my $tree = $cldr->make_inheritance_tree( 'pt-FR' );
8389              
8390             produces:
8391              
8392             ['pt-FR', 'pt-PT', 'pt', 'und']
8393              
8394             Why? Because the C<CLDR> (Common Locale Data Repository) specifies a special parent for locale C<pt-FR>. Those exceptions are defined in L<common/supplemental/supplementalData.xml with xpath /supplementalData/parentLocales/parentLocale|https://github.com/unicode-org/cldr/blob/2dd06669d833823e26872f249aa304bc9d9d2a90/common/supplemental/supplementalData.xml#L5414>
8395              
8396             Another example:
8397              
8398             # Traditional Chinese
8399             my $tree = $cldr->make_inheritance_tree( 'yue-Hant' );
8400              
8401             Normally, this parent would be C<yue>, which would lead to simplified Chinese, which would not be appropriate, so instead the C<CLDR> provides C<zh-Hant>
8402              
8403             ['yue-Hant', 'zh-Hant', 'und']
8404              
8405             If an error occurred, it will set an L<error object|Locale::Unicode::Data::Exception> and return C<undef> in scalar context and an empty list in list context.
8406              
8407             See the L<LDML specifications about inheritance|https://unicode.org/reports/tr35/tr35.html#Inheritance_and_Validity> and about L<locale inheritance and matching|https://unicode.org/reports/tr35/tr35.html#Locale_Inheritance> for more information.
8408              
8409             =head2 metazone
8410              
8411             my $ref = $cldr->metazone( metazone => 'Japan' ); # Japan Standard Time
8412             # Returns an hash reference like this:
8413             {
8414             metazone_id => 98,
8415             metazone => 'Japan',
8416             territories => ["001"],
8417             timezones => ["Asia/Tokyo"],
8418             }
8419              
8420             Returns an hash reference of a C<metazone> information from the table L<metazones|/"Table metazones"> for a given C<metazone> ID.
8421              
8422             Quoting from the L<LDML specifications|https://unicode.org/reports/tr35/tr35-dates.html#Metazone_Names>: "A metazone is a grouping of one or more internal TZIDs that share a common display name in current customary usage, or that have shared a common display name during some particular time period. For example, the zones Europe/Paris, Europe/Andorra, Europe/Tirane, Europe/Vienna, Europe/Sarajevo, Europe/Brussels, Europe/Zurich, Europe/Prague, Europe/Berlin, and so on are often simply designated Central European Time (or translated equivalent)."
8423              
8424             Also: "Metazones are used with the 'z', 'zzzz', 'v', and 'vvvv' date time pattern characters, and not with the 'Z', 'ZZZZ', 'VVVV' and other pattern characters for time zone formatting."
8425              
8426             The meaning of the fields are as follows:
8427              
8428             =over 4
8429              
8430             =item * C<metazone_id>
8431              
8432             A unique incremental value automatically generated by SQLite.
8433              
8434             =item * C<metazone>
8435              
8436             A C<metazone> ID as defined by the L<LDML specifications|https://unicode.org/reports/tr35/tr35-dates.html#Metazone_Names>
8437              
8438             =item * C<territory>
8439              
8440             An array of C<territory> IDs as can be found in the L<table territories|/"Table territories">, and that are associated with this C<metazone>.
8441              
8442             =item * C<timezones>
8443              
8444             An array of C<timezone> IDs as can be found in the L<table timezones|/"Table timezones">, and that are associated with this C<metazone>.
8445              
8446             =back
8447              
8448             =head2 metazones
8449              
8450             my $all = $cldr->metazones;
8451              
8452             Returns all metazones information from L<table metazones|/"Table metazones"> as an array reference of hash reference.
8453              
8454             No additional parameter is needed.
8455              
8456             =head2 metazone_names
8457              
8458             my $ref = $cldr->metazone_names(
8459             locale => 'en',
8460             metazone => 'Japan',
8461             width => 'long',
8462             );
8463             # Returns an hash reference like this:
8464             {
8465             metatz_name_id => 4822,
8466             locale => 'ja',
8467             metazone => 'Japan',
8468             width => 'long',
8469             generic => 'Japan Time',
8470             standard => 'Japan Standard Time',
8471             daylight => 'Japan Daylight Time',
8472             }
8473              
8474             Returns an hash reference of a C<metazone> names localised information from the table L<metazones_names|/"Table metazones_names"> for a given C<locale> ID, C<metazone> and C<width> value.
8475              
8476             The meaning of the fields are as follows:
8477              
8478             =over 4
8479              
8480             =item * C<metatz_name_id>
8481              
8482             A unique incremental value automatically generated by SQLite.
8483              
8484             =item * C<locale>
8485              
8486             A C<locale>, such as C<en> or C<ja-JP> as can be found in table L<locales|/"Table locales">
8487              
8488             =item * C<metazone>
8489              
8490             A C<metazone> such as can be found in table L<metazones|/"Table metazones">
8491              
8492             =item * C<width>
8493              
8494             A C<metazone> localised name C<width>, which can be either C<long> or C<short>
8495              
8496             Note that not all metazones names have both C<width> defined.
8497              
8498             =item * C<generic>
8499              
8500             The C<metazone> C<generic> name.
8501              
8502             =item * C<standard>
8503              
8504             The C<metazone> C<standard> name.
8505              
8506             =item * C<standard>
8507              
8508             The C<metazone> C<daylight> name defined if the C<metazone> use daylight saving time system.
8509              
8510             =back
8511              
8512             See the L<LDML specifications|https://unicode.org/reports/tr35/tr35-dates.html#Metazone_Names> for more information.
8513              
8514             =head2 metazones_names
8515              
8516             my $all = $cldr->metazones_names;
8517             my $all = $cldr->metazones_names( locale => 'ja' );
8518             my $all = $cldr->metazones_names( width => 'long' );
8519             my $all = $cldr->metazones_names(
8520             locale => 'ja',
8521             width => 'long',
8522             );
8523              
8524             Returns all C<metazone> localised formats from L<table metazones_names|/"Table metazones_names"> as an array reference of hash reference.
8525              
8526             A combination of the following fields may be provided to filter the information returned:
8527              
8528             =over 4
8529              
8530             =item * C<locale>
8531              
8532             A C<locale>, such as C<en> or C<ja-JP> as can be found in table L<locales|/"Table locales">
8533              
8534             =item * C<metazone>
8535              
8536             A C<metazone> such as can be found in table L<metazones|/"Table metazones">
8537              
8538             =item * C<width>
8539              
8540             A C<metazone> localised name C<width>, which can be either C<long> or C<short>
8541              
8542             Note that not all timezones names have both C<width> defined.
8543              
8544             =back
8545              
8546             =head2 normalise
8547              
8548             This takes a Unicode C<locale>, which can be quite complexe, and normalise it, by replacing outdated elements (C<subtag>) in the C<language>, C<script>, C<territory> or C<variant> part.
8549              
8550             it returns a new L<Locale::Unicode> object
8551              
8552             You can also call this method as C<normalize>
8553              
8554             =for Pod::Coverage normalize
8555              
8556             =head2 number_format_l10n
8557              
8558             my $ref = $cldr->number_format_l10n(
8559             locale => 'en',
8560             number_system => 'latn',
8561             number_type => 'currency',
8562             format_length => 'short',
8563             format_type => 'standard',
8564             alt => undef,
8565             count => 'one',
8566             format_id => 1000,
8567             );
8568             # Returns an hash reference like this:
8569             {
8570             number_format_id => 2897,
8571             locale => 'en',
8572             number_system => 'latn',
8573             number_type => 'currency',
8574             format_length => 'short',
8575             format_type => 'standard',
8576             format_id => 1000,
8577             format_pattern => '¤0K',
8578             alt => undef,
8579             count => 'one',
8580             }
8581              
8582             Returns an hash reference of a number format localised information from the table L<number_formats_l10n|/"Table number_formats_l10n"> for a given C<locale> ID, L<number system|/number_systems>, C<number_type>, C<format_length>, C<format_type>, C<alt>, C<count>, and C<format_id>. If no C<alt> value or C<count> value is provided, it will default to C<undef>
8583              
8584             The meaning of the fields are as follows:
8585              
8586             =over 4
8587              
8588             =item * C<number_format_id>
8589              
8590             A unique incremental value automatically generated by SQLite.
8591              
8592             =item * C<locale>
8593              
8594             A C<locale>, such as C<en> or C<ja-JP> as can be found in table L<locales|/"Table locales">
8595              
8596             =item * C<number_system>
8597              
8598             A C<number_system> ID as can be found in the L<table number_systems|/"Table number_systems">
8599              
8600             =item * C<number_type>
8601              
8602             A string representing a number type.
8603              
8604             Known values are: C<currency>, C<decimal>, C<misc>, C<percent>, C<scientific>
8605              
8606             =item * C<format_length>
8607              
8608             A string representing a format length.
8609              
8610             Known values are: C<default>, C<long>, C<short>
8611              
8612             =item * C<format_type>
8613              
8614             A string representing a format type.
8615              
8616             Known values are: C<accounting>, C<default>, C<standard>
8617              
8618             =item * C<format_id>
8619              
8620             A string representing a format ID.
8621              
8622             Known values are:
8623              
8624             =over 8
8625              
8626             =item * C<1000>
8627              
8628             Thousand
8629              
8630             =item * C<10000>
8631              
8632             10 thousand
8633              
8634             =item * C<100000>
8635              
8636             100 thousand
8637              
8638             =item * C<1000000>
8639              
8640             Million
8641              
8642             =item * C<10000000>
8643              
8644             10 million
8645              
8646             =item * C<100000000>
8647              
8648             100 million
8649              
8650             =item * C<1000000000>
8651              
8652             Billion
8653              
8654             =item * C<10000000000>
8655              
8656             10 billion
8657              
8658             =item * C<100000000000>
8659              
8660             100 billion
8661              
8662             =item * C<1000000000000>
8663              
8664             Trillion
8665              
8666             =item * C<10000000000000>
8667              
8668             10 trillion
8669              
8670             =item * C<100000000000000>
8671              
8672             100 trillion
8673              
8674             =item * C<1000000000000000>
8675              
8676             Quadrillion
8677              
8678             =item * C<10000000000000000>
8679              
8680             10 quadrillion
8681              
8682             =item * C<100000000000000000>
8683              
8684             100 quadrillion
8685              
8686             =item * C<1000000000000000000>
8687              
8688             Quintillion
8689              
8690             =item * C<10000000000000000000>
8691              
8692             10 quintillion
8693              
8694             =item * C<atLeast>
8695              
8696             =item * C<atMost>
8697              
8698             =item * C<range>
8699              
8700             =item * C<default>
8701              
8702             =item * C<approximately>
8703              
8704             =back
8705              
8706             =item * C<format_pattern>
8707              
8708             A string representing a localised pattern.
8709              
8710             =item * C<alt>
8711              
8712             A string to specify an alternative value for the same C<format_id>
8713              
8714             =item * C<count>
8715              
8716             A string representing a C<count>
8717              
8718             Known values are: C<undef>, C<1>, C<few>, C<many>, C<one>, C<other>, C<two>, C<zero>
8719              
8720             =back
8721              
8722             See the L<LDML specifications|https://unicode.org/reports/tr35/tr35-numbers.html#Number_Formats> for more information.
8723              
8724             =head2 number_formats_l10n
8725              
8726             my $all = $cldr->number_formats_l10n;
8727             my $all = $cldr->number_formats_l10n( locale => 'en' );
8728             my $all = $cldr->number_formats_l10n(
8729             locale => 'en',
8730             number_system => 'latn',
8731             number_type => 'currency',
8732             format_length => 'short',
8733             format_type => 'standard',
8734             );
8735              
8736             Returns all number formats localised information from L<table number_formats_l10n|/"Table number_formats_l10n"> as an array reference of hash reference.
8737              
8738             A combination of the following fields may be provided to filter the information returned:
8739              
8740             =over 4
8741              
8742             =item * C<locale>
8743              
8744             A C<locale>, such as C<en> or C<ja-JP> as can be found in table L<locales|/"Table locales">
8745              
8746             =item * C<number_system>
8747              
8748             A C<number_system> ID as can be found in the L<table number_systems|/"Table number_systems">
8749              
8750             =item * C<number_type>
8751              
8752             A string representing a number type.
8753              
8754             Known values are: C<currency>, C<decimal>, C<misc>, C<percent>, C<scientific>
8755              
8756             =item * C<format_length>
8757              
8758             A string representing a format length.
8759              
8760             Known values are: C<default>, C<long>, C<short>
8761              
8762             =item * C<format_type>
8763              
8764             A string representing a format type.
8765              
8766             Known values are: C<accounting>, C<default>, C<standard>
8767              
8768             =back
8769              
8770             =head2 number_symbol_l10n
8771              
8772             my $ref = $cldr->number_symbol_l10n(
8773             locale => 'en',
8774             number_system => 'latn',
8775             property => 'decimal',
8776             alt => undef,
8777             );
8778             # Returns an hash reference like this:
8779             {
8780             number_symbol_id => 113,
8781             locale => 'en',
8782             number_system => 'latn',
8783             property => 'decimal',
8784             value => '.',
8785             alt => undef,
8786             }
8787              
8788             Returns an hash reference of a number symbol localised information from the table L<number_symbols_l10n|/"Table number_symbols_l10n"> for a given C<locale> ID, C<number_system>, C<property> value and C<alt> value. If no C<alt> value is provided, it will default to C<undef>
8789              
8790             The meaning of the fields are as follows:
8791              
8792             =over 4
8793              
8794             =item * C<number_symbol_id>
8795              
8796             A unique incremental value automatically generated by SQLite.
8797              
8798             =item * C<locale>
8799              
8800             A C<locale>, such as C<en> or C<ja-JP> as can be found in table L<locales|/"Table locales">
8801              
8802             =item * C<number_system>
8803              
8804             A C<number_system> ID as can be found in the L<table number_systems|/"Table number_systems">
8805              
8806             There are 69 number systems used in this L<table number_symbols_l10n|/"Table number_symbols_l10n"> out of the 88 known in the L<table number_systems|/"Table number_systems">
8807              
8808             =item * C<property>
8809              
8810             A string representing a number property.
8811              
8812             Known values are: C<approximately>, C<currency_decimal>, C<currency_group>, C<decimal>, C<exponential>, C<group>, C<infinity>, C<list>, C<minus>, C<nan>, C<per_mille>, C<percent>, C<plus>, C<superscript>, C<time_separator>
8813              
8814             Note that not all locales have all those properties defined.
8815              
8816             For example, the C<locale> C<en> has the following properties defined for number system C<latn>: C<decimal>, C<exponential>, C<group>, C<infinity>, C<list>, C<minus>, C<nan>, C<per_mille>, C<percent>, C<plus>, C<superscript>
8817              
8818             Whereas, the C<locale> C<ja> only has this property defined and only for the number system C<latn>: C<approximately>
8819              
8820             This is because, it inherits from C<root>, i.e. the special C<locale> C<und>
8821              
8822             =item * C<alt>
8823              
8824             A string specified to provide for an alternative property value for the same property name.
8825              
8826             =back
8827              
8828             =head2 number_symbols_l10n
8829              
8830             my $all = $cldr->number_symbols_l10n;
8831             my $all = $cldr->number_symbols_l10n( locale => 'en' );
8832             my $all = $cldr->number_symbols_l10n(
8833             locale => 'en',
8834             number_system => 'latn',
8835             );
8836              
8837             Returns all number symbols localised information from L<table number_symbols_l10n|/"Table number_symbols_l10n"> as an array reference of hash reference.
8838              
8839             A combination of the following fields may be provided to filter the information returned:
8840              
8841             =over 4
8842              
8843             =item * C<locale>
8844              
8845             A C<locale>, such as C<en> or C<ja-JP> as can be found in table L<locales|/"Table locales">
8846              
8847             =item * C<number_system>
8848              
8849             A C<number_system> ID as can be found in the L<table number_systems|/"Table number_systems">
8850              
8851             =back
8852              
8853             =head2 number_system
8854              
8855             my $ref = $cldr->number_system( number_system => 'jpan' );
8856             # Returns an hash reference like this:
8857             {
8858             numsys_id => 35,
8859             number_system => 'jpan',
8860             digits => ["〇", "一", "二", "三", "四", "五", "六", "七", "八", "九"],
8861             type => 'algorithmic',
8862             }
8863              
8864             Returns an hash reference of a C<number_system> information from the table L<number_systems|/"Table number_systems"> for a given C<number_system> ID.
8865              
8866             There are 88 known number systems.
8867              
8868             The meaning of the fields are as follows:
8869              
8870             =over 4
8871              
8872             =item * C<numsys_id>
8873              
8874             A unique incremental value automatically generated by SQLite.
8875              
8876             =item * C<number_system>
8877              
8878             A string representing a number system ID.
8879              
8880             =item * C<digits>
8881              
8882             An array of digits in their locale form, from 0 to 9
8883              
8884             =item * C<type>
8885              
8886             A string representing the type for this number system.
8887              
8888             Known types are: C<algorithmic>, C<numeric>
8889              
8890             =back
8891              
8892             =head2 number_systems
8893              
8894             my $all = $cldr->number_systems;
8895              
8896             Returns all number systems information from L<table number_systems|/"Table number_systems"> as an array reference of hash reference.
8897              
8898             There are 88 known number systems:
8899              
8900             =over 4
8901              
8902             =item * C<adlm>
8903              
8904             Adlam Digits
8905              
8906             =item * C<ahom>
8907              
8908             Ahom Digits
8909              
8910             =item * C<arab>
8911              
8912             Arabic-Indic Digits
8913              
8914             =item * C<arabext>
8915              
8916             Extended Arabic-Indic Digits
8917              
8918             =item * C<arabext>
8919              
8920             X Arabic-Indic Digits
8921              
8922             =item * C<armn>
8923              
8924             Armenian Numerals
8925              
8926             =item * C<armnlow>
8927              
8928             Armenian Lowercase Numerals
8929              
8930             =item * C<bali>
8931              
8932             Balinese Digits
8933              
8934             =item * C<beng>
8935              
8936             Bangla Digits
8937              
8938             =item * C<bhks>
8939              
8940             Bhaiksuki Digits
8941              
8942             =item * C<brah>
8943              
8944             Brahmi Digits
8945              
8946             =item * C<cakm>
8947              
8948             Chakma Digits
8949              
8950             =item * C<cham>
8951              
8952             Cham Digits
8953              
8954             =item * C<cyrl>
8955              
8956             Cyrillic Numerals
8957              
8958             =item * C<deva>
8959              
8960             Devanagari Digits
8961              
8962             =item * C<diak>
8963              
8964             Dives Akuru Digits
8965              
8966             =item * C<ethi>
8967              
8968             Ethiopic Numerals
8969              
8970             =item * C<fullwide>
8971              
8972             Full-Width Digits
8973              
8974             =item * C<geor>
8975              
8976             Georgian Numerals
8977              
8978             =item * C<gong>
8979              
8980             Gunjala Gondi digits
8981              
8982             =item * C<gonm>
8983              
8984             Masaram Gondi digits
8985              
8986             =item * C<grek>
8987              
8988             Greek Numerals
8989              
8990             =item * C<greklow>
8991              
8992             Greek Lowercase Numerals
8993              
8994             =item * C<gujr>
8995              
8996             Gujarati Digits
8997              
8998             =item * C<guru>
8999              
9000             Gurmukhi Digits
9001              
9002             =item * C<hanidays>
9003              
9004             Chinese Calendar Day-of-Month Numerals
9005              
9006             =item * C<hanidec>
9007              
9008             Chinese Decimal Numerals
9009              
9010             =item * C<hans>
9011              
9012             Simplified Chinese Numerals
9013              
9014             =item * C<hansfin>
9015              
9016             Simplified Chinese Financial Numerals
9017              
9018             =item * C<hant>
9019              
9020             Traditional Chinese Numerals
9021              
9022             =item * C<hantfin>
9023              
9024             Traditional Chinese Financial Numerals
9025              
9026             =item * C<hebr>
9027              
9028             Hebrew Numerals
9029              
9030             =item * C<hmng>
9031              
9032             Pahawh Hmong Digits
9033              
9034             =item * C<hmnp>
9035              
9036             Nyiakeng Puachue Hmong Digits
9037              
9038             =item * C<java>
9039              
9040             Javanese Digits
9041              
9042             =item * C<jpan>
9043              
9044             Japanese Numerals
9045              
9046             =item * C<jpanfin>
9047              
9048             Japanese Financial Numerals
9049              
9050             =item * C<jpanyear>
9051              
9052             Japanese Calendar Gannen Year Numerals
9053              
9054             =item * C<kali>
9055              
9056             Kayah Li Digits
9057              
9058             =item * C<kawi>
9059              
9060             Kawi Digits
9061              
9062             =item * C<khmr>
9063              
9064             Khmer Digits
9065              
9066             =item * C<knda>
9067              
9068             Kannada Digits
9069              
9070             =item * C<lana>
9071              
9072             Tai Tham Hora Digits
9073              
9074             =item * C<lanatham>
9075              
9076             Tai Tham Tham Digits
9077              
9078             =item * C<laoo>
9079              
9080             Lao Digits
9081              
9082             =item * C<latn>
9083              
9084             Western Digits
9085              
9086             =item * C<lepc>
9087              
9088             Lepcha Digits
9089              
9090             =item * C<limb>
9091              
9092             Limbu Digits
9093              
9094             =item * C<mathbold>
9095              
9096             Mathematical Bold Digits
9097              
9098             =item * C<mathdbl>
9099              
9100             Mathematical Double-Struck Digits
9101              
9102             =item * C<mathmono>
9103              
9104             Mathematical Monospace Digits
9105              
9106             =item * C<mathsanb>
9107              
9108             Mathematical Sans-Serif Bold Digits
9109              
9110             =item * C<mathsans>
9111              
9112             Mathematical Sans-Serif Digits
9113              
9114             =item * C<mlym>
9115              
9116             Malayalam Digits
9117              
9118             =item * C<modi>
9119              
9120             Modi Digits
9121              
9122             =item * C<mong>
9123              
9124             Mongolian Digits
9125              
9126             =item * C<mroo>
9127              
9128             Mro Digits
9129              
9130             =item * C<mtei>
9131              
9132             Meetei Mayek Digits
9133              
9134             =item * C<mymr>
9135              
9136             Myanmar Digits
9137              
9138             =item * C<mymrshan>
9139              
9140             Myanmar Shan Digits
9141              
9142             =item * C<mymrtlng>
9143              
9144             Myanmar Tai Laing Digits
9145              
9146             =item * C<nagm>
9147              
9148             Nag Mundari Digits
9149              
9150             =item * C<newa>
9151              
9152             Newa Digits
9153              
9154             =item * C<nkoo>
9155              
9156             N’Ko Digits
9157              
9158             =item * C<olck>
9159              
9160             Ol Chiki Digits
9161              
9162             =item * C<orya>
9163              
9164             Odia Digits
9165              
9166             =item * C<osma>
9167              
9168             Osmanya Digits
9169              
9170             =item * C<rohg>
9171              
9172             Hanifi Rohingya digits
9173              
9174             =item * C<roman>
9175              
9176             Roman Numerals
9177              
9178             =item * C<romanlow>
9179              
9180             Roman Lowercase Numerals
9181              
9182             =item * C<saur>
9183              
9184             Saurashtra Digits
9185              
9186             =item * C<segment>
9187              
9188             Segmented Digits
9189              
9190             =item * C<shrd>
9191              
9192             Sharada Digits
9193              
9194             =item * C<sind>
9195              
9196             Khudawadi Digits
9197              
9198             =item * C<sinh>
9199              
9200             Sinhala Lith Digits
9201              
9202             =item * C<sora>
9203              
9204             Sora Sompeng Digits
9205              
9206             =item * C<sund>
9207              
9208             Sundanese Digits
9209              
9210             =item * C<takr>
9211              
9212             Takri Digits
9213              
9214             =item * C<talu>
9215              
9216             New Tai Lue Digits
9217              
9218             =item * C<taml>
9219              
9220             Traditional Tamil Numerals
9221              
9222             =item * C<tamldec>
9223              
9224             Tamil Digits
9225              
9226             =item * C<telu>
9227              
9228             Telugu Digits
9229              
9230             =item * C<thai>
9231              
9232             Thai Digits
9233              
9234             =item * C<tibt>
9235              
9236             Tibetan Digits
9237              
9238             =item * C<tirh>
9239              
9240             Tirhuta Digits
9241              
9242             =item * C<tnsa>
9243              
9244             Tangsa Digits
9245              
9246             =item * C<vaii>
9247              
9248             Vai Digits
9249              
9250             =item * C<wara>
9251              
9252             Warang Citi Digits
9253              
9254             =item * C<wcho>
9255              
9256             Wancho Digits
9257              
9258             =back
9259              
9260             =head2 number_system_l10n
9261              
9262             my $ref = $cldr->number_system_l10n(
9263             number_system => 'jpan',
9264             locale => 'en',
9265             );
9266             # Returns an hash reference like this:
9267             {
9268             num_sys_l10n_id => 1335,
9269             locale => 'en',
9270             number_system => 'jpan',
9271             locale_name => 'Japanese Numerals',
9272             alt => undef,
9273             }
9274              
9275             Returns an hash reference of a C<number_system> localised information from the table L<number_systems_l10n|/"Table number_systems_l10n"> for a given C<number_system> ID and a C<locale> ID.
9276              
9277             There are 190 known localised information for number systems.
9278              
9279             The meaning of the fields are as follows:
9280              
9281             =over 4
9282              
9283             =item * C<num_sys_l10n_id>
9284              
9285             A unique incremental value automatically generated by SQLite.
9286              
9287             =item * C<number_system>
9288              
9289             A string representing a number system ID.
9290              
9291             =item * C<locale_name>
9292              
9293             A string representing the number system in the C<locale>
9294              
9295             =item * C<alt>
9296              
9297             A string specifying an alternative version for an otherwise same number system.
9298              
9299             =back
9300              
9301             =head2 number_systems_l10n
9302              
9303             my $all = $cldr->number_systems_l10n;
9304              
9305             Returns all number systems localised information from L<table number_systems_l10n|/"Table number_systems_l10n"> as an array reference of hash reference.
9306              
9307             =head2 person_name_default
9308              
9309             my $ref = $cldr->person_name_default( locale => 'ja' );
9310             # Returns an hash reference like this:
9311             {
9312             pers_name_def_id => 3,
9313             locale => 'ja',
9314             value => 'surnameFirst',
9315             }
9316              
9317             Returns an hash reference of a person name defaults information from the table L<person_name_defaults|/"Table person_name_defaults"> for a given C<locale> ID.
9318              
9319             Be aware that there are very few data. This is because the entry for locale C<und> (undefined), contains the default value. Thus, if there is no data for the desired locale, you should fallback to C<und>
9320              
9321             This is the way the Unicode CLDR data is structured.
9322              
9323             =head2 person_name_defaults
9324              
9325             my $all = $cldr->person_name_defaults;
9326              
9327             Returns all person name defaults information from L<table person_name_defaults|/"Table person_name_defaults"> as an array reference of hash reference.
9328              
9329             =head2 plural_count
9330              
9331             my $str = $cldr->plural_count( 3, 'ja-t-de-t0-und-x0-medical' );
9332             # "other"
9333             my $str = $cldr->plural_count( -2, 'he-IL-u-ca-hebrew-tz-jeruslm' );
9334             # "two"
9335             my $str = $cldr->plural_count( 3.5, 'ru' );
9336             # "other"
9337              
9338             Provided with a number, and a C<locale>, and this will return a string representing the type of C<count> for the plural value, which may be one of C<zero>, C<one>, C<two>, C<few>, C<many> or C<other>
9339              
9340             This is used for example by L<DateTime::Format::RelativeTime> to query L<time_relative_l10n|/time_relative_l10n> to get the localised relative time value.
9341              
9342             If an error has occurred, this will set an L<error object|Locale::Unicode::Data::Exception>, and return C<undef> in scalar context, or an empty list in list context.
9343              
9344             See also L<plural_range|/plural_range> and L<plural_rule|/plural_rule>
9345              
9346             =head2 plural_forms
9347              
9348             my $rule = $cldr->plural_forms( 'en' );
9349             # nplurals=2; plural=(n != 1);
9350              
9351             my $rule = $cldr->plural_forms( 'ja' );
9352             # nplurals=1; plural=0;
9353              
9354             my $rule = $cldr->plural_forms( 'ar' );
9355             # nplurals=6; plural=(n==0 ? 0 : n==1 ? 1 : n==2 ? 2 : n%100>=3 && n%100<=10 ? 3 : n%100>=11 ? 4 : 5);
9356              
9357             # Alias to 'ar'
9358             my $rule = $cldr->plural_forms( 'ars' );
9359             # nplurals=6; plural=(n==0 ? 0 : n==1 ? 1 : n==2 ? 2 : n%100>=3 && n%100<=10 ? 3 : n%100>=11 ? 4 : 5);
9360              
9361             # No rule found
9362             my $rule = $cldr->plural_forms( 'xxx' );
9363             # Returns an empty string
9364              
9365             This method returns the gettext Plural-Forms string for a given locale, or an empty string if no rule was found.
9366              
9367             It returns a gettext C<Plural-Forms> string, or an empty string if no rule was found for the given locale.
9368              
9369             If no locale is provided, or if there is an error retrieving the data, an error is set in the object, and C<undef> is returned in scalar context, or an empty list in list context.
9370              
9371             See also L<Locale::Unicode::Data/plural_rules>
9372              
9373             =head2 plural_range
9374              
9375             my $ref = $cldr->plural_range(
9376             locale => 'am',
9377             start => 'one',
9378             stop => 'other',
9379             );
9380             # Returns an hash reference like this:
9381             {
9382             plural_range_id => 1335,
9383             locale => 'am',
9384             aliases => [qw(as bn gu hi hy kn mr ps zu)],
9385             start => 'one',
9386             stop => 'other',
9387             result => 'other',
9388             }
9389              
9390             Returns an hash reference of a C<plural_range> information from the table L<plural_ranges|/"Table plural_ranges"> for a given C<start> count, a C<stop> count and a C<locale> ID.
9391              
9392             For example:
9393              
9394             my $num = '2-7';
9395             my $range = [split( /-/, $num, 2 )];
9396             # Will get a string like: zero, one, two, few, many, or other
9397             my $start = $cldr->plural_count( $range->[0], $locale );
9398             my $end = $cldr->plural_count( $range->[1], $locale );
9399             my $ref = $cldr->plural_range( locale => $locale, start => $start, stop => $end );
9400             # zero, one, two, few, many, or other
9401             my $count = $ref->{result};
9402             my $def = $cldr->time_relative_l10n(
9403             locale => $locale,
9404             # For example: second, minute, hour, day, week, month, quarter, or year
9405             field_type => $unit,
9406             # long, short or narrow
9407             field_length => $this_style,
9408             # -1 for past, or 1 for present or future
9409             relative => substr( $num, 0, 1 ) eq '-' ? -1 : 1,
9410             count => $count,
9411             );
9412             # Resulting in a pattern containing {0} that needs to be replaced with the range
9413             $def->{pattern} =~ s/\{0\}/$num/;
9414             say $def->{pattern};
9415              
9416             The meaning of the fields are as follows:
9417              
9418             =over 4
9419              
9420             =item * C<plural_range_id>
9421              
9422             A unique incremental value automatically generated by SQLite.
9423              
9424             =item * C<aliases>
9425              
9426             An array reference of C<locale> values.
9427              
9428             =item * C<start>
9429              
9430             A string representing the starting count value.
9431              
9432             =item * C<stop>
9433              
9434             A string representing the ending count value.
9435              
9436             =item * C<result>
9437              
9438             A string representing the resulting count value.
9439              
9440             =back
9441              
9442             =head2 plural_ranges
9443              
9444             my $all = $cldr->plural_ranges;
9445             my $all = $cldr->plural_ranges( locale => 'he' );
9446             my $all = $cldr->plural_ranges( start => 'one' );
9447             my $all = $cldr->plural_ranges( start => 'one', stop => 'many' );
9448             my $all = $cldr->plural_ranges( result => 'other' );
9449              
9450             Returns all plural ranges information from L<table plural_ranges|/"Table plural_ranges"> as an array reference of hash reference.
9451              
9452             A combination of the following fields may be provided to filter the information returned:
9453              
9454             =over 4
9455              
9456             =item * C<locale>
9457              
9458             A C<locale> such as C<en> or C<ja-JP> as can be found in table L<locales|/"Table locales">
9459              
9460             =item * C<start>
9461              
9462             A string representing the starting count value.
9463              
9464             =item * C<stop>
9465              
9466             A string representing the ending count value.
9467              
9468             =item * C<result>
9469              
9470             A string representing the resulting count value.
9471              
9472             =back
9473              
9474             =head2 plural_rule
9475              
9476             my $ref = $cldr->plural_rule(
9477             locale => 'am',
9478             count => 'one',
9479             );
9480             # Returns an hash reference like this:
9481             {
9482             plural_rule_id => 1335,
9483             locale => 'am',
9484             aliases => [qw(as bn doi fa gu hi kn pcm zu)],
9485             count => 'one',
9486             rule => 'i = 0 or n = 1 @integer 0, 1 @decimal 0.0~1.0, 0.00~0.04',
9487             }
9488              
9489             Returns an hash reference of a C<plural_rule> information from the table L<plural_rules|/"Table plural_rules"> for a given C<start> count, a C<stop> count and a C<locale> ID.
9490              
9491             The meaning of the fields are as follows:
9492              
9493             =over 4
9494              
9495             =item * C<plural_rule_id>
9496              
9497             A unique incremental value automatically generated by SQLite.
9498              
9499             =item * C<aliases>
9500              
9501             An array reference of C<locale> values.
9502              
9503             =item * C<count>
9504              
9505             A string representing the count value.
9506              
9507             =item * C<rule>
9508              
9509             A string representing the plural rule.
9510              
9511             =back
9512              
9513             See also the L<Unicode documentation|https://unicode.org/reports/tr35/tr35-numbers.html#Language_Plural_Rules>, and L<also here|https://cldr.unicode.org/index/cldr-spec/plural-rules>, and L<here|https://unicode.org/reports/tr35/tr35-dates.html#Contents>.
9514              
9515             =head2 plural_rules
9516              
9517             my $all = $cldr->plural_rules;
9518             my $all = $cldr->plural_rules( locale => 'he' );
9519             my $all = $cldr->plural_rules( count => 'one' );
9520              
9521             Returns all plural ranges information from L<table plural_rules|/"Table plural_rules"> as an array reference of hash reference.
9522              
9523             A combination of the following fields may be provided to filter the information returned:
9524              
9525             =over 4
9526              
9527             =item * C<locale>
9528              
9529             A C<locale> such as C<en> or C<ja-JP> as can be found in table L<locales|/"Table locales">
9530              
9531             =item * C<aliases>
9532              
9533             An array reference of C<locale> values.
9534              
9535             =item * C<count>
9536              
9537             A string representing the count value.
9538              
9539             =back
9540              
9541             See also the L<Unicode documentation|https://unicode.org/reports/tr35/tr35-numbers.html#Language_Plural_Rules>, and L<also here|https://cldr.unicode.org/index/cldr-spec/plural-rules>, and L<here|https://unicode.org/reports/tr35/tr35-dates.html#Contents>.
9542              
9543             =head2 rbnf
9544              
9545             my $ref = $cldr->rbnf(
9546             locale => 'ja',
9547             ruleset => 'spellout-cardinal',
9548             rule_id => 7,
9549             );
9550             # Returns an hash reference like this:
9551             {
9552             rbnf_id => 7109,
9553             locale => 'ja',
9554             grouping => 'SpelloutRules',
9555             ruleset => 'spellout-cardinal',
9556             rule_id => '7',
9557             rule_value => '七;',
9558             }
9559              
9560             Returns an hash reference of a RBNF (Rule-Based Number Format) information from the table L<rbnf|/"Table rbnf"> for a given C<locale> ID, a rule set C<ruleset> and a rule ID C<rule_id>.
9561              
9562             The meaning of the fields are as follows:
9563              
9564             =over 4
9565              
9566             =item * C<rbnf_id>
9567              
9568             A unique incremental value automatically generated by SQLite.
9569              
9570             =item * C<locale>
9571              
9572             A C<locale>, such as C<en> or C<ja-JP> as can be found in table L<locales|/"Table locales">
9573              
9574             =item * C<grouping>
9575              
9576             A string representing a C<RBNF> grouping.
9577              
9578             Known values are: C<NumberingSystemRules>, C<OrdinalRules>, C<SpelloutRules>
9579              
9580             =item * C<ruleset>
9581              
9582             A string representing the rule set name.
9583              
9584             =item * C<rule_id>
9585              
9586             A string representing the rule ID.
9587              
9588             =item * C<rule_value>
9589              
9590             A string containing the rule value.
9591              
9592             Make sure to read the C<LDML> documentation, as it may contain information to alias this rule on another one.
9593              
9594             =back
9595              
9596             =head2 rbnfs
9597              
9598             my $all = $cldr->rbnfs;
9599             my $all = $cldr->rbnfs( locale => 'ko' );
9600             my $all = $cldr->rbnfs( grouping => 'SpelloutRules' );
9601             my $all = $cldr->rbnfs( ruleset => 'spellout-cardinal-native' );
9602              
9603             Returns all RBNF (Rule-Based Number Format) information from L<table rbnf|/"Table rbnf"> as an array reference of hash reference.
9604              
9605             A combination of the following fields may be provided to filter the information returned:
9606              
9607             =over 4
9608              
9609             =item * C<grouping>
9610              
9611             A group value. Known values are: C<NumberingSystemRules>, C<OrdinalRules> and C<SpelloutRules>
9612              
9613             =item * C<locale>
9614              
9615             A C<locale> such as C<en> or C<ja-JP> as can be found in table L<locales|/"Table locales">
9616              
9617             =item * C<ruleset>
9618              
9619             The name of a rule set.
9620              
9621             =back
9622              
9623             =head2 reference
9624              
9625             my $ref = $cldr->reference( code => 'R1131' );
9626             # Returns an hash reference like this:
9627             {
9628             ref_id => 132,
9629             code => 'R1131',
9630             uri => 'http://en.wikipedia.org/wiki/Singapore',
9631             description => 'English is the first language learned by half the children by the time they reach preschool age; using 92.6% of pop for the English figure',
9632             }
9633              
9634             Returns an hash reference of a reference information from the table L<refs|/"Table refs"> for a given C<code>.
9635              
9636             =head2 references
9637              
9638             my $all = $cldr->references;
9639              
9640             Returns all reference information from L<table refs|/"Table refs"> as an array reference of hash reference.
9641              
9642             No additional parameter is needed.
9643              
9644             =head2 script
9645              
9646             my $ref = $cldr->script( script => 'Jpan' );
9647             # Returns an hash reference like this:
9648             {
9649             script_id => 73,
9650             script => 'Jpan',
9651             rank => 5,
9652             sample_char => '3048',
9653             id_usage => 'RECOMMENDED',
9654             rtl => 0,
9655             lb_letters => 1,
9656             has_case => 0,
9657             shaping_req => 0,
9658             ime => 1,
9659             density => 2,
9660             origin_country => 'JP',
9661             likely_language => 'ja',
9662             status => 'regular',
9663             }
9664              
9665             Returns an hash reference of a C<script> information from the table L<scripts|/"Table scripts"> for a given C<script> ID.
9666              
9667             The meaning of the fields are as follows:
9668              
9669             The information is quoted directly from the C<CLDR> data.
9670              
9671             =over 4
9672              
9673             =item * C<script_id>
9674              
9675             A unique incremental value automatically generated by SQLite.
9676              
9677             =item * C<script>
9678              
9679             A string representing a C<script> ID
9680              
9681             =item * C<rank>
9682              
9683             "The approximate rank of this script from a large sample of the web, in terms of the number of characters found in that script. Below 32 the ranking is not statistically significant."
9684              
9685             =item * C<sample_char>
9686              
9687             "A sample character for use in "Last Resort" style fonts. For printing the combining mark for Zinh in a chart, U+25CC can be prepended. See http://unicode.org/policies/lastresortfont_eula.html"
9688              
9689             =item * C<id_usage>
9690              
9691             "The usage for IDs (tables 4-7) according to UAX #31."
9692              
9693             For a description of values, see
9694              
9695             L<http://unicode.org/reports/tr31/#Table_Candidate_Characters_for_Exclusion_from_Identifiers>
9696              
9697             =item * C<rtl>
9698              
9699             True "if the script is RTL. Derived from whether the script contains RTL letters according to the Bidi_Class property"
9700              
9701             =item * C<lb_letters>
9702              
9703             True "if the major languages using the script allow linebreaks between letters (excluding hyphenation). Derived from LB property."
9704              
9705             =item * C<has_case>
9706              
9707             True "if in modern (or most recent) usage case distinctions are customary."
9708              
9709             =item * C<shaping_req>
9710              
9711             True "if shaping is required for the major languages using that script for NFC text. This includes not only ligation (and Indic conjuncts), Indic vowel splitting/reordering, and Arabic-style contextual shaping, but also cases where NSM placement is required, like Thai. MIN if NSM placement is sufficient, not the more complex shaping. The NSM placement may only be necessary for some major languages using the script."
9712              
9713             =item * C<ime>
9714              
9715             Input Method Engine.
9716              
9717             True "if the major languages using the script require IMEs. In particular, users (of languages for that script) would be accustomed to using IMEs (such as Japanese) and typical commercial products for those languages would need IME support in order to be competitive."
9718              
9719             =item * C<density>
9720              
9721             "The approximate information density of characters in this script, based on comparison of bilingual texts."
9722              
9723             =item * C<origin_country>
9724              
9725             "The approximate area where the script originated, expressed as a BCP47 region code."
9726              
9727             =item * C<likely_language>
9728              
9729             The likely C<language> associated with this C<script>
9730              
9731             =item * C<status>
9732              
9733             A string representing the status for this C<script>
9734              
9735             Known values are: C<deprecated>, C<private_use>, C<regular>, C<reserved>, C<special>, C<unknown>
9736              
9737             =back
9738              
9739             See also the L<Unicode list of known scripts|https://www.unicode.org/iso15924/iso15924-codes.html>
9740              
9741             =head2 scripts
9742              
9743             my $all = $cldr->scripts;
9744             my $all = $cldr->scripts( rtl => 1 );
9745             my $all = $cldr->scripts( origin_country => 'FR' );
9746             my $all = $cldr->scripts( likely_language => 'fr' );
9747              
9748             Returns all scripts information from L<table scripts|/"Table scripts"> as an array reference of hash reference.
9749              
9750             A combination of the following fields may be provided to filter the information returned:
9751              
9752             =over 4
9753              
9754             =item * C<likely_language>
9755              
9756             A C<locale> such as C<en> or C<ja-JP> as can be found in table L<locales|/"Table locales">
9757              
9758             =item * C<origin_country>
9759              
9760             A C<territory> code as can be found in table L<territories|/"Table territories">
9761              
9762             =item * C<rtl>
9763              
9764             A boolean value. C<0> for false and C<1> for true.
9765              
9766             =back
9767              
9768             =head2 script_l10n
9769              
9770             my $ref = $cldr->script_l10n(
9771             locale => 'en',
9772             script => 'Latn',
9773             alt => undef,
9774             );
9775             # Returns an hash reference like this:
9776             {
9777             scripts_l10n_id => 3636,
9778             locale => 'en',
9779             script => 'Latn',
9780             locale_name => 'Latin',
9781             alt => undef,
9782             }
9783              
9784             Returns an hash reference of a C<script> localised information from the table L<scripts_l10n|/"Table scripts_l10n"> for a given C<script> ID and a C<locale> ID and a C<alt> value. If no C<alt> value is provided, it will default to C<undef>
9785              
9786             The meaning of the fields are as follows:
9787              
9788             =over 4
9789              
9790             =item * C<scripts_l10n_id>
9791              
9792             This is a unique incremental integer automatically generated by SQLite.
9793              
9794             =item * C<locale>
9795              
9796             A C<locale> such as C<en> or C<ja-JP> as can be found in table L<locales|/"Table locales">
9797              
9798             =item * C<script>
9799              
9800             A 3 to 4-characters script ID as can be found in the L<table scripts|/"Table scripts">
9801              
9802             =item * C<locale_name>
9803              
9804             The localised script name based on the C<locale> specified.
9805              
9806             =item * C<alt>
9807              
9808             A string, that is optional, and is used to provide an alternative version. Known C<alt> values are: C<undef>, C<secondary>, C<short>, C<stand-alone>, C<variant>
9809              
9810             =back
9811              
9812             =head2 scripts_l10n
9813              
9814             my $all = $cldr->scripts_l10n;
9815             my $all = $cldr->scripts_l10n( locale => 'en' );
9816             my $all = $cldr->scripts_l10n(
9817             locale => 'en',
9818             alt => undef,
9819             );
9820              
9821             Returns all localised scripts information from L<table scripts_l10n|/"Table scripts_l10n"> as an array reference of hash reference.
9822              
9823             A combination of the following fields may be provided to filter the information returned:
9824              
9825             =over 4
9826              
9827             =item * C<locale>
9828              
9829             A C<locale> such as C<en> or C<ja-JP> as can be found in table L<locales|/"Table locales">
9830              
9831             =item * C<alt>
9832              
9833             A string, that is optional, and is used to provide an alternative version. Known C<alt> values are: C<undef>, C<secondary>, C<short>, C<stand-alone>, C<variant>
9834              
9835             =back
9836              
9837             =head2 split_interval
9838              
9839             my $ref = $cldr->split_interval(
9840             pattern => $string,
9841             greatest_diff => 'd',
9842             ) || die( $cldr->error );
9843              
9844             This takes an hash or hash reference of options and it returns a 4-elements array reference containing:
9845              
9846             =over 4
9847              
9848             =item 1. first part of the pattern
9849              
9850             =item 2. the separator, which may be an empty string
9851              
9852             =item 3. second part of the pattern
9853              
9854             =item 4. the best repeating pattern found
9855              
9856             =back
9857              
9858             The required options are:
9859              
9860             =over 4
9861              
9862             =item * C<greatest_diff>
9863              
9864             A token representing the greatest difference.
9865              
9866             Known values are: C<B>, C<G>, C<H>, C<M>, C<a>, C<d>, C<h>, C<m>, C<y>
9867              
9868             See L</"Format Patterns"> for their meaning.
9869              
9870             =item * C<pattern>
9871              
9872             A interval pattern, such as one you can get with the method L<calendar_interval_format|/calendar_interval_format>
9873              
9874             =back
9875              
9876             This method is provided as a convenience, but the L<interval formats data|/calendar_interval_format> in L<the database|/"Table calendar_interval_formats"> have already been pre-processed, so you do not have to do it.
9877              
9878             =head2 subdivision
9879              
9880             my $ref = $cldr->subdivision( subdivision => 'jp12' );
9881             # Returns an hash reference like this:
9882             {
9883             subdivision_id => 2748,
9884             territory => 'JP',
9885             subdivision => 'jp12',
9886             parent => 'JP',
9887             is_top_level => 1,
9888             status => 'regular',
9889             }
9890              
9891             Returns an hash reference of a subdivision information from the table L<subdivisions|/"Table subdivisions"> for a given C<subdivision> ID.
9892              
9893             The meaning of the fields are as follows:
9894              
9895             =over 4
9896              
9897             =item * C<subdivision_id>
9898              
9899             A unique incremental value automatically generated by SQLite.
9900              
9901             =item * C<territory>
9902              
9903             A C<territory> ID, such as can be found in table L<territories|/"Table territories">
9904              
9905             =item * C<subdivision>
9906              
9907             A string representing a C<subdivision> ID
9908              
9909             =item * C<parent>
9910              
9911             A string representing a parent for this C<subdivision>. It can be either another C<subdivision> ID, or a C<territory> ID, if this is a top C<subdivision>
9912              
9913             =item * C<is_top_level>
9914              
9915             A boolean value representing whether this C<subdivision> is directly under a C<territory> or rather under another C<subdivision>
9916              
9917             =item * C<status>
9918              
9919             A string representing the status for this C<subdivision>.
9920              
9921             Known values are: C<deprecated>, C<regular>, C<unknown>
9922              
9923             =back
9924              
9925             =head2 subdivisions
9926              
9927             my $all = $cldr->subdivisions;
9928             my $all = $cldr->subdivisions( territory => 'JP' );
9929             my $all = $cldr->subdivisions( parent => 'US' );
9930             my $all = $cldr->subdivisions( is_top_level => 1 );
9931              
9932             Returns all subdivisions information from L<table subdivisions|/"Table subdivisions"> as an array reference of hash reference.
9933              
9934             A combination of the following fields may be provided to filter the information returned:
9935              
9936             =over 4
9937              
9938             =item * C<is_top_level>
9939              
9940             A boolean value. C<0> for false and C<1> for true.
9941              
9942             =item * C<parent>
9943              
9944             A C<territory> code as can be found in table L<territories|/"Table territories">
9945              
9946             =item * C<territory>
9947              
9948             A C<territory> code as can be found in table L<territories|/"Table territories">
9949              
9950             =back
9951              
9952             =head2 subdivision_l10n
9953              
9954             my $ref = $cldr->subdivision_l10n(
9955             locale => 'en',
9956             # Texas
9957             subdivision => 'ustx',
9958             );
9959             # Returns an hash reference like this:
9960             {
9961             subdiv_l10n_id => 56463,
9962             locale => 'en',
9963             subdivision => 'ustx',
9964             locale_name => 'Texas',
9965             }
9966              
9967             Returns an hash reference of a C<subdivision> localised information from the table L<subdivisions_l10n|/"Table subdivisions_l10n"> for a given C<subdivision> ID and a C<locale> ID.
9968              
9969             The meaning of the fields are as follows:
9970              
9971             =over 4
9972              
9973             =item * C<subdiv_l10n_id>
9974              
9975             A unique incremental value automatically generated by SQLite.
9976              
9977             =item * C<locale>
9978              
9979             A C<locale>, such as C<en> or C<ja-JP> as can be found in table L<locales|/"Table locales">
9980              
9981             =item * C<subdivision>
9982              
9983             A C<subdivision> ID as can be found from the L<table subdivisions|/"Table subdivision">
9984              
9985             =item * C<locale_name>
9986              
9987             A string representing the localised name of the C<subdivision> in the C<locale> specified.
9988              
9989             =back
9990              
9991             See the L<LDML specifications|https://unicode.org/reports/tr35/tr35.html#Unicode_Subdivision_Codes> for more information.
9992              
9993             =head2 subdivisions_l10n
9994              
9995             my $all = $cldr->subdivisions_l10n;
9996             my $all = $cldr->subdivisions_l10n( locale => 'en' );
9997              
9998             Returns all subdivisions localised information from L<table subdivisions_l10n|/"Table subdivisions_l10n"> as an array reference of hash reference.
9999              
10000             A combination of the following fields may be provided to filter the information returned:
10001              
10002             =over 4
10003              
10004             =item * C<locale>
10005              
10006             A C<locale>, such as C<en> or C<ja-JP> as can be found in table L<locales|/"Table locales">
10007              
10008             =back
10009              
10010             =head2 territory
10011              
10012             my $ref = $cldr->territory( territory => 'FR' );
10013             # Returns an hash reference like this:
10014             {
10015             territory_id => 118,
10016             territory => 'FR',
10017             parent => 155,
10018             gdp => 2856000000000,
10019             literacy_percent => 99,
10020             population => 67848200,
10021             languages => ["fr", "en", "es", "de", "oc", "it", "pt", "pcd", "gsw", "br", "co", "hnj", "ca", "eu", "nl", "frp", "ia"],
10022             contains => undef,
10023             currency => 'EUR',
10024             calendars => undef,
10025             min_days => 4,
10026             first_day => 1,
10027             weekend => undef,
10028             status => 'regular',
10029             }
10030              
10031             Returns an hash reference of a territory information from the table L<territories|/"Table territories"> for a given C<territory> ID.
10032              
10033             The meaning of the fields are as follows:
10034              
10035             =over 4
10036              
10037             =item * C<territory>
10038              
10039             A 2-characters code designating a country code, which may not necessarily be an active ISO 3166 code, because the CLDR keeps outdated ones for consistency.
10040              
10041             It can also be a 3-digits world region code.
10042              
10043             =item * C<parent>
10044              
10045             A C<parent> territory, if one is defined. For example, France (C<FR>) has parent C<155> representing Western Europe, which has parent C<150>, representing Europe, which, itself, has parent C<001>, representing the world.
10046              
10047             =item * C<gdp>
10048              
10049             The territory GDP (Gross Domestic Product), which may be C<undef>, especially for world region.
10050              
10051             =item * C<literacy_percent>
10052              
10053             The literacy percentage of the population expressed as a decimal. For example, a value of C<99> means 99%
10054              
10055             =item * C<population>
10056              
10057             The territory population as an integer.
10058              
10059             =item * C<languages>
10060              
10061             The languages known to be spoken in this territory, as an array of C<language> IDs. For significant languages, you can get more information, such as their share of the population with L<language_population|/language_population>
10062              
10063             =item * C<contains>
10064              
10065             An array of C<territory> codes contained by this territory. This may be C<undef>
10066              
10067             This value is typically set for world C<region> codes and for special territories like C<EU>, C<EZ>, C<QO> and C<UN>
10068              
10069             =item * C<currency>
10070              
10071             The official C<currency> used in this territory. This may be C<undef> such as for world regions.
10072              
10073             =item * C<calendars>
10074              
10075             An array of L<calendar systems|/calendar> used in this C<territory>
10076              
10077             =item * C<min_days>
10078              
10079             This is used to decide if the week starting with C<first_day> is to ne included in the calendar as the first week of the new yer or last week of the previous year.
10080              
10081             See the L<LDML specifications|https://unicode.org/reports/tr35/tr35-dates.html#Week_Data>
10082              
10083             =item * C<first_day>
10084              
10085             The first day of the week. Although in the Unicode LDML, the I<weekday names are identified with short strings, since there is no universally-accepted numeric designation>, here the value used is an integer from C<1> (Monday) to C<7> (Sunday)
10086              
10087             =item * C<weekend>
10088              
10089             An array of week days (identified by integers as explained in C<first_day>). This value may be null, in which case, the default value to be used is the one set in the World region (C<001>), which is C<[6,7]>, i.e. Saturday and Sunday.
10090              
10091             =item * C<status>
10092              
10093             A string representing the C<status> for this territory.
10094              
10095             Known C<status> values are: C<deprecated>, C<macroregion>, C<private_use>, C<regular>, C<reserved>, C<special>, C<unknown>
10096              
10097             =back
10098              
10099             =head2 territories
10100              
10101             my $all = $cldr->territories;
10102             my $all = $cldr->territories( parent => 150 );
10103              
10104             Returns all territories information from L<table territories|/"Table territories"> as an array reference of hash reference.
10105              
10106             A combination of the following fields may be provided to filter the information returned:
10107              
10108             =over 4
10109              
10110             =item * C<parent>
10111              
10112             A C<territory> code as can be found in table L<territories|/"Table territories">
10113              
10114             =back
10115              
10116             =head2 territory_l10n
10117              
10118             my $ref = $cldr->territory_l10n(
10119             locale => 'en',
10120             territory => 'JP',
10121             alt => undef,
10122             );
10123             # Returns an hash reference like this:
10124             {
10125             terr_l10n_id => 13385,
10126             locale => 'en',
10127             territory => 'JP',
10128             locale_name => 'Japan',
10129             alt => undef,
10130             }
10131              
10132             Returns an hash reference of a territory localised information from the table L<territories_l10n|/"Table territories_l10n"> for a given C<territory> ID and a C<locale> ID and an C<alt> value. If no C<alt> value is provided, it will default to C<undef>
10133              
10134             The meaning of the fields are as follows:
10135              
10136             =over 4
10137              
10138             =item * C<terr_l10n_id>
10139              
10140             This is a unique incremental integer automatically generated by SQLite.
10141              
10142             =item * C<locale>
10143              
10144             A C<locale> such as C<en> or C<ja-JP> as can be found in table L<locales|/"Table locales">
10145              
10146             =item * C<territory>
10147              
10148             A 2-characters country code or a 3-digits region code as can be found in the L<table territories|/"Table territories">
10149              
10150             =item * C<locale_name>
10151              
10152             The localised territory name based on the C<locale> specified.
10153              
10154             =item * C<alt>
10155              
10156             A string, that is optional, and is used to provide an alternative version. Known C<alt> values are: C<undef>, C<biot>, C<chagos>, C<short>, C<variant>
10157              
10158             =back
10159              
10160             =head2 territories_l10n
10161              
10162             my $all = $cldr->territories_l10n;
10163             my $all = $cldr->territories_l10n( locale => 'en' );
10164             my $all = $cldr->territories_l10n(
10165             locale => 'en',
10166             alt => undef,
10167             );
10168              
10169             Returns all localised territories information from L<table territories_l10n|/"Table territories_l10n"> as an array reference of hash reference.
10170              
10171             A combination of the following fields may be provided to filter the information returned:
10172              
10173             =over 4
10174              
10175             =item * C<locale>
10176              
10177             A C<locale> such as C<en> or C<ja-JP> as can be found in table L<locales|/"Table locales">
10178              
10179             =item * C<alt>
10180              
10181             A string, that is optional, and is used to provide an alternative version. Known C<alt> values are: C<undef>, C<biot>, C<chagos>, C<short>, C<variant>
10182              
10183             =back
10184              
10185             =head2 time_format
10186              
10187             my $ref = $cldr->time_format( region => 'JP' );
10188             # Returns an hash reference like this:
10189             {
10190             time_format_id => 86,
10191             region => 'JP',
10192             territory => 'JP',
10193             locale => undef,
10194             time_format => 'H',
10195             time_allowed => ["H", "K", "h"],
10196             }
10197              
10198             Returns an hash reference of a time format information from the table L<time_formats|/"Table time_formats"> for a given C<region> ID.
10199              
10200             The meaning of the fields are as follows:
10201              
10202             =over 4
10203              
10204             =item * C<time_format_id>
10205              
10206             A unique incremental value automatically generated by SQLite.
10207              
10208             =item * C<region>
10209              
10210             A string representing a C<region>, which can be a C<territory> code, such as C<US> or C<419>, or a C<language> ID with a C<territory> ID, such as C<it-CH> or C<en-001>.
10211              
10212             =item * C<territory>
10213              
10214             A string representing the C<territory> part of the C<region> as can be found in L<table territories|/"Tabke territories">
10215              
10216             =item * C<locale>
10217              
10218             A string representing the C<locale> part of the C<region> value.
10219              
10220             A C<locale>, such as C<en> or C<ja-JP> as can be found in table L<locales|/"Table locales">
10221              
10222             =item * C<time_format>
10223              
10224             A short string representing a time format.
10225              
10226             Known values are: C<H> and C<h>
10227              
10228             =item * C<time_allowed>
10229              
10230             An array of format allowed.
10231              
10232             For example:
10233              
10234             ["H","h","hB","hb"]
10235              
10236             =back
10237              
10238             See the L<LDML specifications|https://unicode.org/reports/tr35/tr35-dates.html#Time_Data> for more information.
10239              
10240             =head2 time_formats
10241              
10242             my $all = $cldr->time_formats;
10243             my $all = $cldr->time_formats( region => 'US' );
10244             my $all = $cldr->time_formats( territory => 'JP' );
10245             my $all = $cldr->time_formats( locale => undef );
10246             my $all = $cldr->time_formats( locale => 'en' );
10247              
10248             Returns all time formats information from L<table time_formats|/"Table time_formats"> as an array reference of hash reference.
10249              
10250             A combination of the following fields may be provided to filter the information returned:
10251              
10252             =over 4
10253              
10254             =item * C<locale>
10255              
10256             A C<locale> such as C<en> or C<ja-JP> as can be found in table L<locales|/"Table locales">
10257              
10258             =item * C<region>
10259              
10260             A C<territory> code as can be found in table L<territories|/"Table territories">
10261              
10262             =item * C<territory>
10263              
10264             A C<territory> code as can be found in table L<territories|/"Table territories">
10265              
10266             =back
10267              
10268             =head2 time_relative_l10n
10269              
10270             my $ref = $cldr->time_relative_l10n(
10271             locale => 'en',
10272             field_type => 'day',
10273             field_length => 'short',
10274             relative => -1,
10275             # optionally a 'count' value; defaults to 'one'
10276             # count => 'one'
10277             );
10278             # Returns an hash reference like this:
10279             {
10280             time_relative_id => 2087,
10281             locale => 'en',
10282             field_type => 'day',
10283             field_length => 'short',
10284             relative => -1,
10285             format_pattern => '{0} day ago',
10286             count => 'one',
10287             }
10288              
10289             Returns an hash reference of a field localised information from the table L<time_relative_l10n|/"Table time_relative_l10n"> for a given C<locale> ID, C<field_type>, C<field_length> and C<relative> value.
10290              
10291             The meaning of the fields are as follows:
10292              
10293             =over 4
10294              
10295             =item * C<time_relative_id>
10296              
10297             A unique incremental value automatically generated by SQLite.
10298              
10299             =item * C<locale>
10300              
10301             A C<locale>, such as C<en> or C<ja-JP> as can be found in table L<locales|/"Table locales">
10302              
10303             =item * C<field_type>
10304              
10305             A string representing a field type.
10306              
10307             Known values are: C<day>, C<fri>, C<hour>, C<minute>, C<mon>, C<month>, C<quarter>, C<sat>, C<second>, C<sun>, C<thu>, C<tue>, C<wed>, C<week>, C<year>
10308              
10309             =item * C<field_length>
10310              
10311             A string representing a field length.
10312              
10313             Known values are: C<narrow>, C<short>, C<standard>
10314              
10315             =item * C<relative>
10316              
10317             An integer representing the relative value of the field. For example, C<-1> being the past, and C<1> being the future.
10318              
10319             Posible values are: C<-1>, C<1>
10320              
10321             =item * C<format_pattern>
10322              
10323             A string containing the localised pattern based on the C<locale>
10324              
10325             =item * C<count>
10326              
10327             A string representing the count for the pattern. If none is provided, it defaults to C<one>
10328              
10329             Possible values may be: C<zero>, C<one>, C<two>, C<few>, C<many>, C<other>
10330              
10331             =back
10332              
10333             See the L<LDML specifications|https://unicode.org/reports/tr35/tr35-dates.html#Calendar_Fields> for more information.
10334              
10335             =head2 time_relatives_l10n
10336              
10337             my $all = $cldr->time_relatives_l10n;
10338             my $all = $cldr->time_relatives_l10n( locale => 'en' );
10339             my $all = $cldr->time_relatives_l10n(
10340             locale => 'en',
10341             field_type => 'day',
10342             field_length => 'short',
10343             );
10344              
10345             Returns all time relative localised information from L<table time_relative_l10n|/"Table time_relative_l10n"> as an array reference of hash reference.
10346              
10347             A combination of the following fields may be provided to filter the information returned:
10348              
10349             =over 4
10350              
10351             =item * C<locale>
10352              
10353             A C<locale>, such as C<en> or C<ja-JP> as can be found in table L<locales|/"Table locales">
10354              
10355             =item * C<field_type>
10356              
10357             A string representing a field type.
10358              
10359             Known values are: C<day>, C<fri>, C<hour>, C<minute>, C<mon>, C<month>, C<quarter>, C<sat>, C<second>, C<sun>, C<thu>, C<tue>, C<wed>, C<week>, C<year>
10360              
10361             =item * C<field_length>
10362              
10363             A string representing a field length.
10364              
10365             Known values are: C<narrow>, C<short>, C<standard>
10366              
10367             =item * C<count>
10368              
10369             A string representing the count for the pattern.
10370              
10371             Possible values may be: C<zero>, C<one>, C<two>, C<few>, C<many>, C<other>
10372              
10373             =back
10374              
10375             =head2 timezone
10376              
10377             my $ref = $cldr->timezone( timezone => 'Asia/Tokyo' );
10378             # Returns an hash reference like this:
10379             {
10380             timezone_id => 281,
10381             timezone => 'Asia/Tokyo',
10382             territory => 'JP',
10383             region => 'Asia',
10384             tzid => 'japa',
10385             metazone => 'Japan',
10386             tz_bcpid => 'jptyo',
10387             is_golden => 1,
10388             is_primary => 0,
10389             is_preferred => 0,
10390             is_canonical => 0,
10391             }
10392              
10393             Returns an hash reference of a time zone information from the table L<timezones|/"Table timezones"> based on the C<timezone> ID provided.
10394              
10395             The meaning of the fields are as follows:
10396              
10397             =over 4
10398              
10399             =item * C<timezone_id>
10400              
10401             A unique incremental value automatically generated by SQLite.
10402              
10403             =item * C<timezone>
10404              
10405             A C<timezone> ID
10406              
10407             =item * C<territory>
10408              
10409             A string representing a C<territory> code as can be found in L<table territories|/"Table territories">
10410              
10411             =item * C<region>
10412              
10413             A string representing a world region.
10414              
10415             Known regions are; C<Africa>, C<America>, C<Antarctica>, C<Arctic>, C<Asia>, C<Atlantic>, C<Australia>, C<CST6CDT>, C<EST5EDT>, C<Etc>, C<Europe>, C<Indian>, C<MST7MDT>, C<PST8PDT>, C<Pacific>
10416              
10417             =item * C<tzid>
10418              
10419             A string representing a timezone ID
10420              
10421             =item * C<metazone>
10422              
10423             A string representing a metazone ID
10424              
10425             =item * C<tz_bcpid>
10426              
10427             A boolean specifying whether this timezone ID is also a BCP47 C<timezone>.
10428              
10429             =item * C<is_golden>
10430              
10431             A boolean specifying whether this timezone is a golden timezone.
10432              
10433             A C<timezone> is deemed C<golden> if it is specified in the C<CLDR> as part of the L<primaryZones|https://unicode.org/reports/tr35/tr35-dates.html#Primary_Zones> or if the C<timezone> territory is C<001> (World).
10434              
10435             As explained in the L<LDML specifications|https://unicode.org/reports/tr35/tr35-dates.html#Using_Time_Zone_Names>, "[t]he golden zones are those in mapZone supplemental data under the territory C<001>."
10436              
10437             =item * C<is_primary>
10438              
10439             A boolean specifying whether this timezone is a primary timezone.
10440              
10441             As explained in the L<LDML specifications|https://unicode.org/reports/tr35/tr35-dates.html#Primary_Zones>, this "specifies the dominant zone for a region; this zone should use the region name for its generic location name even though there are other canonical zones available in the same region. For example, C<Asia/Shanghai> is displayed as C<China Time>, instead of C<Shanghai Time>"
10442              
10443             =item * C<is_preferred>
10444              
10445             A boolean specifying whether this timezone is the preferred timezone for this C<metazone>
10446              
10447             =item * C<is_canonical>
10448              
10449             A boolean specifying whether this timezone is the canonical timezone, since it can have multiple aliases.
10450              
10451             =back
10452              
10453             =head2 timezones
10454              
10455             my $array_ref = $cldr->timezones;
10456             # Or, providing with some filtering arguments
10457             # Returns all the timezones for the country code 'JP'
10458             my $array_ref = $cldr->timezones( territory => 'JP' );
10459             # Returns all the timezones for the region code 'Asia'
10460             my $array_ref = $cldr->timezones( region => 'Asia' );
10461             # Returns all the timezones that match the CLDR timezone ID 'japa'
10462             my $array_ref = $cldr->timezones( tzid => 'japa' );
10463             # Returns all the timezones that match the BCP47 timezone ID 'jptyo'
10464             my $array_ref = $cldr->timezones( tz_bcpid => 'jptyo' );
10465             # Returns all the timezones that have the CLDR metazone 'Japan'
10466             my $array_ref = $cldr->timezones( metazone => 'Japan' );
10467             # Returns all the timezones that are 'golden' timezones
10468             my $array_ref = $cldr->timezones( is_golden => 1 );
10469             my $array_ref = $cldr->timezones( is_primary => 1 );
10470             my $array_ref = $cldr->timezones( is_canonical => 1 );
10471              
10472             Returns all the C<timezone> information as an array reference of hash reference from the L<table timezones|/"Table timezones">
10473              
10474             You can adjust the data return by using a combination of the following filtering arguments:
10475              
10476             =over 4
10477              
10478             =item * C<territory>
10479              
10480             A C<territory> code as can be found in table L<territories|/"Table territories">
10481              
10482             =item * C<region>
10483              
10484             A world region. Known values are: C<Africa>, C<America>, C<Antarctica>, C<Arctic>, C<Asia>, C<Atlantic>, C<Australia>, C<CST6CDT>, C<EST5EDT>, C<Etc>, C<Europe>, C<Indian>, C<MST7MDT>, C<PST8PDT>, C<Pacific>
10485              
10486             =item * C<tzid>
10487              
10488             A Unicode timezone ID
10489              
10490             =item * C<tz_bcpid>
10491              
10492             A Unicode BCP47 timezone ID.
10493              
10494             =item * C<metazone>
10495              
10496             A Unicode metazone ID.
10497              
10498             =item * C<is_golden>
10499              
10500             A boolean expressing whether this time zone is C<golden> (in Unicode parlance), or not. C<1> for true, and C<0> for false.
10501              
10502             =item * C<is_primary>
10503              
10504             A boolean specifying whether this timezone is a primary timezone.
10505              
10506             =item * C<is_canonical>
10507              
10508             A boolean specifying whether this timezone is the canonical timezone, since it can have multiple aliases.
10509              
10510             =back
10511              
10512             =head2 timezone_canonical
10513              
10514             my $str = $cldr->timezone_canonical( 'Europe/Paris' );
10515             # Europe/Paris
10516             my $str = $cldr->timezone_canonical( 'America/Atka' );
10517             # America/Adak
10518             my $str = $cldr->timezone_canonical( 'US/Aleutian' );
10519             # America/Adak
10520              
10521             Provided with a C<timezone>, and this returns the canonical timezone corresponding.
10522              
10523             If no matching C<timezone> could be found, an empty string is returned.
10524              
10525             If an error occurred, this sets an L<exception object|Locale::Unicode::Data::Exception>, and returns C<undef> in scalar context, and an empty list in list context.
10526              
10527             =head2 timezone_city
10528              
10529             my $ref = $cldr->timezone_city(
10530             locale => 'de',
10531             timezone => 'Asia/Tokyo',
10532             );
10533             # Returns an hash reference like this:
10534             {
10535             tz_city_id => 7486,
10536             locale => 'de',
10537             timezone => 'Asia/Tokyo',
10538             city => 'Tokio',
10539             alt => undef,
10540             }
10541              
10542             Returns an hash reference of a C<timezone> localised exemplar city from the table L<timezones_cities|/"Table timezones_cities"> for a given C<locale> ID, C<timezone> and C<alt> value. If no C<alt> value is provided, it will default to C<undef>
10543              
10544             The behaviour of this method is altered depending on whether L<extend_timezones_cities|/extend_timezones_cities> is set to a true boolean value or not. If set to true, this will retrieve the data from the table C<timezones_cities_extended> instead of the C<timezones_cities>
10545              
10546             By default, L<extend_timezones_cities|/extend_timezones_cities> is set to true, and the L<Locale::Unicode::Data> distribution comes with an extended set of time zones cities. The default Unicode CLDR data comes only with a minimal set.
10547              
10548             This method is especially used to format the pattern characters C<v> and C<V>. See the section on L<Format Patterns|/"Format Patterns"> for more about this.
10549              
10550             The meaning of the fields are as follows:
10551              
10552             =over 4
10553              
10554             =item * C<tz_city_id>
10555              
10556             A unique incremental value automatically generated by SQLite.
10557              
10558             =item * C<locale>
10559              
10560             A C<locale>, such as C<en> or C<ja-JP> as can be found in table L<locales|/"Table locales">
10561              
10562             =item * C<timezone>
10563              
10564             A C<timezone> ID as can be found in the L<table timezones|/"Table timezones">
10565              
10566             =item * C<city>
10567              
10568             A localised version of a representative city for this given C<timezone>.
10569              
10570             Note that not all locales have a localised city for all timezones.
10571              
10572             =item * C<alt>
10573              
10574             A string specified to provide for an alternative city value for the same city name.
10575              
10576             Known values are: C<undef> and C<secondary>
10577              
10578             =back
10579              
10580             =head2 timezones_cities
10581              
10582             my $all = $cldr->timezones_cities;
10583             my $all = $cldr->timezones_cities( locale => 'ja' );
10584             my $all = $cldr->timezones_cities(
10585             locale => 'ja',
10586             alt => undef,
10587             );
10588              
10589             Returns all timezone localised representative city name from L<table timezones_cities|/"Table timezones_cities"> as an array reference of hash reference.
10590              
10591             The behaviour of this method is altered depending on whether L<extend_timezones_cities|/extend_timezones_cities> is set to a true boolean value or not. If set to true, this will retrieve the data from the table C<timezones_cities_extended> instead of the C<timezones_cities>
10592              
10593             By default, L<extend_timezones_cities|/extend_timezones_cities> is set to true, and the L<Locale::Unicode::Data> distribution comes with an extended set of time zones cities. The default Unicode CLDR data comes only with a minimal set.
10594              
10595             This method is especially used to format the pattern characters C<v> and C<V>. See the section on L<Format Patterns|/"Format Patterns"> for more about this.
10596              
10597             A combination of the following fields may be provided to filter the information returned:
10598              
10599             =over 4
10600              
10601             =item * C<locale>
10602              
10603             A C<locale>, such as C<en> or C<ja-JP> as can be found in table L<locales|/"Table locales">
10604              
10605             =item * C<alt>
10606              
10607             A string used to differentiate two version of a localised city name.
10608              
10609             Known values are: C<undef> and C<secondary>
10610              
10611             =back
10612              
10613             =head2 timezone_formats
10614              
10615             my $ref = $cldr->timezone_formats(
10616             locale => 'en',
10617             type => 'region',
10618             subtype => 'standard',
10619             );
10620             # Returns an hash reference like this:
10621             {
10622             tz_fmt_id => 145,
10623             locale => 'en',
10624             type => 'region',
10625             subtype => 'standard',
10626             format_pattern => '{0} Standard Time',
10627             }
10628              
10629             Returns an hash reference of a C<timezone> formats localised information from the table L<timezones_formats|/"Table timezones_formats"> for a given C<locale> ID, C<type> and optional C<subtype> value. If no C<subtype> value is provided, it will default to C<undef>
10630              
10631             The meaning of the fields are as follows:
10632              
10633             =over 4
10634              
10635             =item * C<tz_fmt_id>
10636              
10637             A unique incremental value automatically generated by SQLite.
10638              
10639             =item * C<locale>
10640              
10641             A C<locale>, such as C<en> or C<ja-JP> as can be found in table L<locales|/"Table locales">
10642              
10643             =item * C<type>
10644              
10645             A format type. This can be either: C<fallback>, C<gmt>, C<gmt_zero>, C<hour> and C<region>
10646              
10647             =over 4
10648              
10649             =item * C<fallback>
10650              
10651             Quoting the L<LDML specifications|https://unicode.org/reports/tr35/tr35-dates.html#fallbackFormat>: "a formatting string such as C<{1} ({0})>, where C<{1}> is the metazone, and C<{0}> is the country or city."
10652              
10653             For example: C<{1} ({0})>, which would yield in English: C<Pacific Time (Canada)>
10654              
10655             =item * C<gmt>
10656              
10657             A formatting string, such as C<GMT{0}>, where C<{0}> is the GMT offset in hour, minute, and possibly seconds, using the C<hour> formatting.
10658              
10659             For example: C<GMT{0}>, which would yield in English: C<GMT-0800>
10660              
10661             =item * C<hour>
10662              
10663             2 formatting strings separated by a semicolon; one for the positive offset formatting and the other for the negative offset formatting.
10664              
10665             See the section on L<formatting patterns|/"Format Patterns"> for the significance of the letters used in formatting.
10666              
10667             For example: C<+HHmm;-HHmm>, which would yield in English: C<+1200>
10668              
10669             =item * C<gmt_zero>
10670              
10671             For example: C<GMT>
10672              
10673             This specifies how GMT/UTC with no explicit offset (implied 0 offset) should be represented.
10674              
10675             =item * C<region>
10676              
10677             Quoting the L<LDML specifications|https://unicode.org/reports/tr35/tr35-dates.html#Time_Zone_Format_Terminology>: "a formatting string such as C<{0} Time>, where C<{0}> is the country or city."
10678              
10679             For example: C<{0} Daylight Time>, which would yield in English: C<France Daylight Time>, or in Spanish, the pattern C<horario de verano de {0}>, which would yield C<horario de verano de Francia>
10680              
10681             =back
10682              
10683             =item * C<subtype>
10684              
10685             A C<timezone> format subtype, such as C<daylight>, C<standard>
10686              
10687             Note that not all timezones and locales have a localised C<daylight> or C<standard> format
10688              
10689             =item * C<format_pattern>
10690              
10691             A string representing the format pattern.
10692              
10693             =back
10694              
10695             See the L<LDML specifications|https://unicode.org/reports/tr35/tr35-dates.html#Using_Time_Zone_Names> and L<specifications about fallback formats|https://unicode.org/reports/tr35/tr35-dates.html#timeZoneNames_Elements_Used_for_Fallback> for more information.
10696              
10697             =head2 timezones_formats
10698              
10699             my $all = $cldr->timezones_formats;
10700             my $all = $cldr->timezones_formats( locale => 'ja' );
10701             my $all = $cldr->timezones_formats(
10702             locale => 'ja',
10703             type => 'region',
10704             );
10705             my $all = $cldr->timezones_formats(
10706             locale => 'ja',
10707             subtype => 'standard',
10708             );
10709             my $all = $cldr->timezones_formats(
10710             format_pattern => '{0} Daylight Time',
10711             );
10712              
10713             Returns all C<timezone> localised formats from L<table timezones_formats|/"Table timezones_formats"> as an array reference of hash reference.
10714              
10715             A combination of the following fields may be provided to filter the information returned:
10716              
10717             =over 4
10718              
10719             =item * C<locale>
10720              
10721             A C<locale>, such as C<en> or C<ja-JP> as can be found in table L<locales|/"Table locales">
10722              
10723             =item * C<type>
10724              
10725             A format type. This can be either: C<fallback>, C<gmt>, C<gmt_zero>, C<hour> and C<region>
10726              
10727             =item * C<subtype>
10728              
10729             A C<timezone> format subtype, such as C<daylight>, C<standard>
10730              
10731             Note that not all timezones and locales have a localised C<daylight> or C<standard> format
10732              
10733             =back
10734              
10735             =head2 timezone_info
10736              
10737             my $ref = $cldr->timezone_info(
10738             timezone => 'Europe/Simferopol',
10739             start => '1994-04-30T21:00:00',
10740             );
10741             # Returns an hash reference like this:
10742             {
10743             tzinfo_id => 594,
10744             timezone => 'Europe/Simferopol',
10745             metazone => 'Moscow',
10746             start => '1994-04-30T21:00:00',
10747             until => '1997-03-30T01:00:00',
10748             }
10749              
10750             or, maybe, simpler, using the L<advanced search|/"Advanced Search">:
10751              
10752             my $ref = $cldr->timezone_info(
10753             timezone => 'Europe/Simferopol',
10754             start => ['>1992-01-01', '<1995-01-01'],
10755             );
10756              
10757             That way, you do not need to know the exact date.
10758              
10759             Returns an hash reference of a C<timezone> historical information from the table L<timezones_info|/"Table timezones_info"> for a given C<timezone> ID and a C<start> datetime. If no C<start> value is provided, it will default to C<undef>
10760              
10761             The meaning of the fields are as follows:
10762              
10763             =over 4
10764              
10765             =item * C<tzinfo_id>
10766              
10767             A unique incremental value automatically generated by SQLite.
10768              
10769             =item * C<timezone>
10770              
10771             A C<timezone>, such as C<Asia/Tokyo> table L<timezones|/"Table timezones">
10772              
10773             =item * C<metazone>
10774              
10775             A C<metazone> ID
10776              
10777             There are 190 known C<metazone> IDs
10778              
10779             =item * C<start>
10780              
10781             An ISO8601 start datetime value for this timezone.
10782              
10783             This may be C<undef>
10784              
10785             =item * C<until>
10786              
10787             An ISO8601 datetime value representing the date and time until which this timezone was valid.
10788              
10789             It may be C<undef>
10790              
10791             =back
10792              
10793             =head2 timezones_info
10794              
10795             my $all = $cldr->timezones_info;
10796             my $all = $cldr->timezones_info( timezone => 'Europe/Simferopol' );
10797             my $all = $cldr->timezones_info( metazone => 'Singapore' );
10798             my $all = $cldr->timezones_info( start => undef );
10799             my $all = $cldr->timezones_info( until => undef );
10800              
10801             Returns all the C<timezone> information as an array reference of hash reference from the L<table timezones_info|/"Table timezones_info">
10802              
10803             You can adjust the data return by using a combination of the following filtering arguments:
10804              
10805             =over 4
10806              
10807             =item * C<metazone>
10808              
10809             A Unicode C<metazone> ID
10810              
10811             =item * C<start>
10812              
10813             An ISO8601 date and time from which to find data. For example: C<2014-10-25T14:00:00>
10814              
10815             =item * C<timezone>
10816              
10817             A C<timezone> value.
10818              
10819             =item * C<until>
10820              
10821             An ISO8601 date and time until which to find data. For example: C<2016-03-26T18:00:00>
10822              
10823             =back
10824              
10825             =head2 timezone_names
10826              
10827             my $ref = $cldr->timezone_names(
10828             locale => 'ja',
10829             timezone => 'Europe/London',
10830             width => 'long',
10831             );
10832             # Returns an hash reference like this:
10833             {
10834             tz_name_id => 85,
10835             locale => 'ja',
10836             timezone => 'Europe/London',
10837             width => 'long',
10838             generic => undef,
10839             standard => undef,
10840             daylight => '英国夏時間',
10841             }
10842              
10843             Returns an hash reference of a C<timezone> names localised information from the table L<timezones_names|/"Table timezones_names"> for a given C<locale> ID, C<timezone> and C<width> value.
10844              
10845             The meaning of the fields are as follows:
10846              
10847             =over 4
10848              
10849             =item * C<tz_name_id>
10850              
10851             A unique incremental value automatically generated by SQLite.
10852              
10853             =item * C<locale>
10854              
10855             A C<locale>, such as C<en> or C<ja-JP> as can be found in table L<locales|/"Table locales">
10856              
10857             =item * C<timezone>
10858              
10859             A C<timezone> such as can be found in table L<timezones|/"Table timezones">
10860              
10861             =item * C<width>
10862              
10863             A C<timezone> localised name C<width>, which can be either C<long> or C<short>
10864              
10865             Note that not all timezones names have both C<width> defined.
10866              
10867             =item * C<generic>
10868              
10869             The C<timezone> C<generic> name.
10870              
10871             =item * C<standard>
10872              
10873             The C<timezone> C<standard> name.
10874              
10875             =item * C<standard>
10876              
10877             The C<timezone> C<daylight> name defined if the C<timezone> use daylight saving time system.
10878              
10879             =back
10880              
10881             See the L<LDML specifications|https://unicode.org/reports/tr35/tr35-dates.html#Time_Zone_Names> for more information.
10882              
10883             =head2 timezones_names
10884              
10885             my $all = $cldr->timezones_names;
10886             my $all = $cldr->timezones_names( locale => 'ja' );
10887             my $all = $cldr->timezones_names( width => 'long' );
10888             my $all = $cldr->timezones_names(
10889             locale => 'ja',
10890             width => 'long',
10891             );
10892              
10893             Returns all C<timezone> localised formats from L<table timezones_names|/"Table timezones_names"> as an array reference of hash reference.
10894              
10895             A combination of the following fields may be provided to filter the information returned:
10896              
10897             =over 4
10898              
10899             =item * C<locale>
10900              
10901             A C<locale>, such as C<en> or C<ja-JP> as can be found in table L<locales|/"Table locales">
10902              
10903             =item * C<timezone>
10904              
10905             A C<timezone> such as can be found in table L<timezones|/"Table timezones">
10906              
10907             =item * C<width>
10908              
10909             A C<timezone> localised name C<width>, which can be either C<long> or C<short>
10910              
10911             Note that not all timezones names have both C<width> defined.
10912              
10913             =back
10914              
10915             =head2 unit_alias
10916              
10917             my $ref = $cldr->unit_alias( alias => 'meter-per-second-squared' );
10918             # Returns an hash reference like this:
10919             {
10920             unit_alias_id => 3,
10921             alias => 'meter-per-second-squared',
10922             target => 'meter-per-square-second',
10923             reason => 'deprecated',
10924             }
10925              
10926             Or, maybe simpler, using the L<advanced search|/"Advanced Search">:
10927              
10928             my $ref = $cldr->unit_alias( alias => '~^meter.*' );
10929              
10930             or
10931              
10932             my $ref = $cldr->unit_alias( alias => qr/^meter.*/ );
10933              
10934             Returns an hash reference of a unit alias information from the table L<unit_aliases|/"Table unit_aliases"> based on the C<alias> ID provided.
10935              
10936             =head2 unit_aliases
10937              
10938             my $all = $cldr->unit_aliases;
10939              
10940             Returns all the unit alias information as an array reference of hash reference from the L<table unit_aliases|/"Table unit_aliases">
10941              
10942             No additional parameter is needed.
10943              
10944             =head2 unit_constant
10945              
10946             my $ref = $cldr->unit_constant( constant => 'lb_to_kg' );
10947             # Returns an hash reference like this:
10948             {
10949             unit_constant_id => 1,
10950             constant => 'lb_to_kg',
10951             expression => 0.45359237,
10952             value => 0.45359237,
10953             description => undef,
10954             status => undef,
10955             }
10956              
10957             Returns an hash reference of a unit constant information from the table L<unit_constants|/"Table unit_constants"> based on the C<constant> ID provided.
10958              
10959             The meaning of the fields are as follows:
10960              
10961             =over 4
10962              
10963             =item * C<unit_constant_id>
10964              
10965             A unique incremental value automatically generated by SQLite.
10966              
10967             =item * C<constant>
10968              
10969             The unit constant ID.
10970              
10971             =item * C<expression>
10972              
10973             The constant expression as defined in C<CLDR>
10974              
10975             =item * C<value>
10976              
10977             The constant resolved value, computed from the C<expression> specified.
10978              
10979             =item * C<description>
10980              
10981             A string describing the constant.
10982              
10983             =item * C<status>
10984              
10985             A string representing the C<status> for this C<constant>
10986              
10987             =back
10988              
10989             =head2 unit_constants
10990              
10991             my $all = $cldr->unit_constants;
10992              
10993             Returns all the unit constants information as an array reference of hash reference from the L<table unit_constants|/"Table unit_constants">
10994              
10995             No additional parameter is needed.
10996              
10997             =head2 unit_conversion
10998              
10999             my $ref = $cldr->unit_conversion( source => 'kilogram' );
11000             # Returns an hash reference like this:
11001             {
11002             unit_conversion_id => 9,
11003             source => 'kilogram',
11004             base_unit => 'kilogram',
11005             expression => undef,
11006             factor => undef,
11007             systems => ["si", "metric"],
11008             category => 'mass',
11009             }
11010              
11011             Returns an hash reference of a unit conversion information from the table L<unit_conversions|/"Table unit_conversions"> based on the C<source> ID provided.
11012              
11013             The meaning of the fields are as follows:
11014              
11015             =over 4
11016              
11017             =item * C<unit_conversion_id>
11018              
11019             A unique incremental value automatically generated by SQLite.
11020              
11021             =item * C<source>
11022              
11023             A string representing the unit source.
11024              
11025             =item * C<base_unit>
11026              
11027             A string representing the base unit for this unit conversion
11028              
11029             =item * C<expression>
11030              
11031             A string representing the unit expression, if any.
11032              
11033             =item * C<factor>
11034              
11035             A string representing the unit factor value, if any.
11036              
11037             =item * C<systems>
11038              
11039             An array of string representing the unit conversion systems.
11040              
11041             =item * C<category>
11042              
11043             A string representing the unit conversion category.
11044              
11045             Known category values are: C<acceleration>, C<angle>, C<area>, C<catalytic-activity>, C<concentration-mass>, C<digital>, C<electric-capacitance>, C<electric-charge>, C<electric-conductance>, C<electric-current>, C<electric-inductance>, C<electric-resistance>, C<energy>, C<force>, C<frequency>, C<graphics>, C<ionizing-radiation>, C<length>, C<luminance>, C<luminous-flux>, C<luminous-intensity>, C<magnetic-flux>, C<magnetic-induction>, C<mass>, C<portion>, C<power>, C<pressure>, C<pressure-per-length>, C<radioactivity>, C<solid-angle>, C<speed>, C<substance-amount>, C<temperature>, C<th>, C<time>, C<typewidth>, C<voltage>, C<volume>, C<year-duration>
11046              
11047             =back
11048              
11049             =head2 unit_conversions
11050              
11051             my $all = $cldr->unit_conversions;
11052             my $all = $cldr->unit_conversions( base_unit => 'kilogram' );;
11053             my $all = $cldr->unit_conversions( category => 'mass' );
11054              
11055             Returns all the unit conversion information as an array reference of hash reference from the L<table unit_conversions|/"Table unit_conversions">
11056              
11057             A combination of the following fields may be provided to filter the information returned:
11058              
11059             =over 4
11060              
11061             =item * C<base_unit>
11062              
11063             A base unit ID.
11064              
11065             =item * C<category>
11066              
11067             A category ID. Known categories are: C<acceleration>, C<angle>, C<area>, C<catalytic-activity>, C<concentration-mass>, C<digital>, C<electric-capacitance>, C<electric-charge>, C<electric-conductance>, C<electric-current>, C<electric-inductance>, C<electric-resistance>, C<energy>, C<force>, C<frequency>, C<graphics>, C<ionizing-radiation>, C<length>, C<luminance>, C<luminous-flux>, C<luminous-intensity>, C<magnetic-flux>, C<magnetic-induction>, C<mass>, C<portion>, C<power>, C<pressure>, C<pressure-per-length>, C<radioactivity>, C<solid-angle>, C<speed>, C<substance-amount>, C<temperature>, C<th>, C<time>, C<typewidth>, C<voltage>, C<volume>, C<year-duration>
11068              
11069             =back
11070              
11071             =head2 unit_l10n
11072              
11073             my $ref = $cldr->unit_l10n(
11074             unit_id => 'length-kilometer',
11075             locale => 'en',
11076             # long, narrow, short
11077             format_length => 'long',
11078             # compound, regular
11079             unit_type => 'regular',
11080             count => 'one',
11081             gender => undef,
11082             gram_case => undef,
11083             );
11084             # Returns an hash reference like this:
11085             {
11086             units_l10n_id => 25599,
11087             locale => 'en',
11088             format_length => 'long',
11089             unit_type => 'regular',
11090             unit_id => 'length-kilometer',
11091             unit_pattern => '{0} kilometer',
11092             pattern_type => 'regular',
11093             locale_name => 'kilometers',
11094             count => 'one',
11095             gender => undef,
11096             gram_case => undef,
11097             }
11098              
11099             Returns an hash reference of a C<unit> localised information from the table L<units_l10n|/"Table units_l10n"> for a given C<locale> ID, C<format_length>, C<unit_type>, C<unit_id>, C<count>, C<gender>, C<gram_case>.
11100              
11101             If no C<count>, C<gender>, or C<gram_case> value is provided, it will default to C<undef>
11102              
11103             The meaning of the fields are as follows:
11104              
11105             =over 4
11106              
11107             =item * C<units_l10n_id>
11108              
11109             A unique incremental value automatically generated by SQLite.
11110              
11111             =item * C<locale>
11112              
11113             A C<locale>, such as C<en> or C<ja-JP> as can be found in table L<locales|/"Table locales">
11114              
11115             =item * C<format_length>
11116              
11117             A string representing the unit format length
11118              
11119             Known values are: C<long>, C<narrow>, C<short>
11120              
11121             =item * C<unit_type>
11122              
11123             A string representing a C<unit> type.
11124              
11125             Known values are: C<compound> and C<regular>
11126              
11127             =item * C<unit_id>
11128              
11129             A string representing a C<unit> ID.
11130              
11131             =item * C<unit_pattern>
11132              
11133             A string representing a localised C<unit> pattern.
11134              
11135             =item * C<pattern_type>
11136              
11137             A string representing a pattern type.
11138              
11139             Known values are: C<per-unit>, C<prefix>, C<regular>
11140              
11141             =item * C<locale_name>
11142              
11143             A string containing the localised representation of this C<unit>
11144              
11145             Note that there is no C<locale_name> value for C<unit> of type C<compound> in the C<CLDR> data.
11146              
11147             =item * C<count>
11148              
11149             A string used to differentiate identical values.
11150              
11151             Known values are: C<undef>, C<one>, C<other>, C<zero>, C<two>, C<few>, C<many>
11152              
11153             =item * C<gender>
11154              
11155             A string representing the C<gender> associated with the C<unit>
11156              
11157             The locales that are known to use C<gender> information for units are:
11158              
11159             =over 8
11160              
11161             =item * C<ar>
11162              
11163             Arabic
11164              
11165             =item * C<ca>
11166              
11167             Catalan
11168              
11169             =item * C<cs>
11170              
11171             Czech
11172              
11173             =item * C<da>
11174              
11175             Danish
11176              
11177             =item * C<de>
11178              
11179             German
11180              
11181             =item * C<el>
11182              
11183             Greek
11184              
11185             =item * C<es>
11186              
11187             Spanish
11188              
11189             =item * C<fr>
11190              
11191             French
11192              
11193             =item * C<fr-CA>
11194              
11195             Canadian French
11196              
11197             =item * C<gu>
11198              
11199             Gujarati
11200              
11201             =item * C<he>
11202              
11203             Hebrew
11204              
11205             =item * C<hi>
11206              
11207             Hindi
11208              
11209             =item * C<hr>
11210              
11211             Croatian
11212              
11213             =item * C<is>
11214              
11215             Icelandic
11216              
11217             =item * C<it>
11218              
11219             Italian
11220              
11221             =item * C<kn>
11222              
11223             Kannada
11224              
11225             =item * C<lt>
11226              
11227             Lithuanian
11228              
11229             =item * C<lv>
11230              
11231             Latvian
11232              
11233             =item * C<ml>
11234              
11235             Malayalam
11236              
11237             =item * C<mr>
11238              
11239             Marathi
11240              
11241             =item * C<nl>
11242              
11243             Dutch
11244              
11245             =item * C<nn>
11246              
11247             Norwegian Nynorsk
11248              
11249             =item * C<no>
11250              
11251             Norwegian
11252              
11253             =item * C<pa>
11254              
11255             Punjabi
11256              
11257             =item * C<pl>
11258              
11259             Polish
11260              
11261             =item * C<pt>
11262              
11263             Portuguese
11264              
11265             =item * C<ro>
11266              
11267             Romanian
11268              
11269             =item * C<ru>
11270              
11271             Russian
11272              
11273             =item * C<sk>
11274              
11275             Slovak
11276              
11277             =item * C<sl>
11278              
11279             Slovenian
11280              
11281             =item * C<sr>
11282              
11283             Serbian
11284              
11285             =item * C<sv>
11286              
11287             Swedish
11288              
11289             =item * C<uk>
11290              
11291             Ukrainian
11292              
11293             =item * C<ur>
11294              
11295             Urdu
11296              
11297             =back
11298              
11299             =item * C<gram_case>
11300              
11301             A string representing a grammatical case.
11302              
11303             Known values are: C<ablative>, C<accusative>, C<dative>, C<elative>, C<ergative>, C<genitive>, C<illative>, C<instrumental>, C<locative>, C<oblique>, C<partitive>, C<prepositional>, C<sociative>, C<terminative>, C<translative>, C<vocative>
11304              
11305             =back
11306              
11307             See the L<LDML specifications|https://unicode.org/reports/tr35/tr35-general.html#Unit_Elements> for more information.
11308              
11309             =head2 units_l10n
11310              
11311             my $all = $cldr->units_l10n;
11312             my $all = $cldr->units_l10n( locale => 'en' );
11313             my $all = $cldr->units_l10n(
11314             locale => 'en',
11315             format_length => 'long',
11316             unit_type => 'regular',
11317             unit_id => 'length-kilometer',
11318             pattern_type => 'regular',
11319             );
11320              
11321             Returns all the unit prefixes information as an array reference of hash reference from the L<table units_l10n|/"Table units_l10n">
11322              
11323             A combination of the following fields may be provided to filter the information returned:
11324              
11325             =over 4
11326              
11327             =item * C<locale>
11328              
11329             A C<locale>, such as C<en> or C<ja-JP> as can be found in table L<locales|/"Table locales">
11330              
11331             =item * C<format_length>
11332              
11333             A string representing the unit format length
11334              
11335             Known values are: C<long>, C<narrow>, C<short>
11336              
11337             =item * C<unit_type>
11338              
11339             A string representing a C<unit> type.
11340              
11341             Known values are: C<compound> and C<regular>
11342              
11343             =item * C<unit_id>
11344              
11345             A string representing a C<unit> ID.
11346              
11347             =item * C<pattern_type>
11348              
11349             A string representing a pattern type.
11350              
11351             Known values are: C<per-unit>, C<prefix>, C<regular>
11352              
11353             =back
11354              
11355             =head2 unit_prefix
11356              
11357             my $ref = $cldr->unit_prefix( unit_id => 'micro' );
11358             # Returns an hash reference like this:
11359             {
11360             unit_prefix_id => 9,
11361             unit_id => 'micro',
11362             symbol => 'μ',
11363             power => 10,
11364             factor => -6,
11365             }
11366              
11367             Returns an hash reference of a unit prefix information from the table L<unit_prefixes|/"Table unit_prefixes"> based on the C<unit_id> ID provided.
11368              
11369             The meaning of the fields are as follows:
11370              
11371             =over 4
11372              
11373             =item * C<unit_prefix_id>
11374              
11375             A unique incremental value automatically generated by SQLite.
11376              
11377             =item * C<unit_id>
11378              
11379             A C<unit> ID
11380              
11381             =item * C<symbol>
11382              
11383             A string representing the unit symbol.
11384              
11385             =item * C<power>
11386              
11387             A value representing the unit power
11388              
11389             =item * C<factor>
11390              
11391             A value representing the unit factor.
11392              
11393             =back
11394              
11395             =head2 unit_prefixes
11396              
11397             my $all = $cldr->unit_prefixes;
11398              
11399             Returns all the unit prefixes information as an array reference of hash reference from the L<table unit_prefixes|/"Table unit_prefixes">
11400              
11401             No additional parameter is needed.
11402              
11403             =head2 unit_pref
11404              
11405             my $ref = $cldr->unit_pref( unit_id => 'square-meter' );
11406             # Returns an hash reference like this:
11407             {
11408             unit_pref_id => 3,
11409             unit_id => 'square-meter',
11410             territory => '001',
11411             category => 'area',
11412             usage => 'default',
11413             geq => undef,
11414             skeleton => undef,
11415             }
11416              
11417             Returns an hash reference of a unit preference information from the table L<unit_prefs|/"Table unit_prefs"> based on the C<unit_id> ID provided.
11418              
11419             =head2 unit_prefs
11420              
11421             my $all = $cldr->unit_prefs;
11422             my $all = $cldr->unit_prefs( territory => 'US' );
11423             my $all = $cldr->unit_prefs( category => 'area' );
11424              
11425             Returns all the unit preferences information as an array reference of hash reference from the L<table unit_prefs|/"Table unit_prefs">
11426              
11427             A combination of the following fields may be provided to filter the information returned:
11428              
11429             =over 4
11430              
11431             =item * C<territory>
11432              
11433             A C<territory> code as can be found in table L<territories|/"Table territories">
11434              
11435             =item * C<category>
11436              
11437             A category ID. Known categories are: C<area>, C<concentration>, C<consumption>, C<duration>, C<energy>, C<length>, C<mass>, C<mass-density>, C<power>, C<pressure>, C<speed>, C<temperature>, C<volume>, C<year-duration>
11438              
11439             =back
11440              
11441             =head2 unit_quantity
11442              
11443             my $ref = $cldr->unit_quantity( base_unit => 'kilogram' );
11444             # Returns an hash reference like this:
11445             {
11446             unit_quantity_id => 4,
11447             base_unit => 'kilogram',
11448             quantity => 'mass',
11449             status => 'simple',
11450             comment => undef,
11451             }
11452              
11453             Returns an hash reference of a unit quantities information from the table L<unit_quantities|/"Table unit_quantities"> based on the C<unit_id> ID provided.
11454              
11455             The meaning of the fields are as follows:
11456              
11457             =over 4
11458              
11459             =item * C<unit_quantity_id>
11460              
11461             A unique incremental value automatically generated by SQLite.
11462              
11463             =item * C<base_unit>
11464              
11465             A string representing the base unit.
11466              
11467             =item * C<quantity>
11468              
11469             A string representing the unit quantity.
11470              
11471             Known values are: C<acceleration>, C<angle>, C<area>, C<catalytic-activity>, C<concentration>, C<concentration-mass>, C<consumption>, C<current-density>, C<digital>, C<duration>, C<electric-capacitance>, C<electric-charge>, C<electric-conductance>, C<electric-current>, C<electric-inductance>, C<electric-resistance>, C<energy>, C<force>, C<frequency>, C<graphics>, C<illuminance>, C<ionizing-radiation>, C<length>, C<luminous-flux>, C<luminous-intensity>, C<magnetic-field-strength>, C<magnetic-flux>, C<magnetic-induction>, C<mass>, C<mass-density>, C<mass-fraction>, C<portion>, C<power>, C<pressure>, C<pressure-per-length>, C<radioactivity>, C<resolution>, C<solid-angle>, C<specific-volume>, C<speed>, C<substance-amount>, C<temperature>, C<typewidth>, C<voltage>, C<volume>, C<wave-number>, C<year-duration>
11472              
11473             =item * C<status>
11474              
11475             A string representing the unit status.
11476              
11477             Known values are: C<undef> and C<simple>
11478              
11479             =item * C<comment>
11480              
11481             A text providing some comments about this unit quantity.
11482              
11483             =back
11484              
11485             =head2 unit_quantities
11486              
11487             my $all = $cldr->unit_quantities;
11488             my $all = $cldr->unit_quantities( quantity => 'mass' );
11489              
11490             Returns all the unit quantities information as an array reference of hash reference from the L<table unit_quantities|/"Table unit_quantities">
11491              
11492             A combination of the following fields may be provided to filter the information returned:
11493              
11494             =over 4
11495              
11496             =item * C<quantity>
11497              
11498             A C<quantity> ID. Known C<quantity> ID are: C<acceleration>, C<angle>, C<area>, C<catalytic-activity>, C<concentration>, C<concentration-mass>, C<consumption>, C<current-density>, C<digital>, C<duration>, C<electric-capacitance>, C<electric-charge>, C<electric-conductance>, C<electric-current>, C<electric-inductance>, C<electric-resistance>, C<energy>, C<force>, C<frequency>, C<graphics>, C<illuminance>, C<ionizing-radiation>, C<length>, C<luminous-flux>, C<luminous-intensity>, C<magnetic-field-strength>, C<magnetic-flux>, C<magnetic-induction>, C<mass>, C<mass-density>, C<mass-fraction>, C<portion>, C<power>, C<pressure>, C<pressure-per-length>, C<radioactivity>, C<resolution>, C<solid-angle>, C<specific-volume>, C<speed>, C<substance-amount>, C<temperature>, C<typewidth>, C<voltage>, C<volume>, C<wave-number>, C<year-duration>
11499              
11500             =back
11501              
11502             =head2 variant
11503              
11504             my $ref = $cldr->variant( variant => 'valencia' );
11505             # Returns an hash reference like this:
11506             {
11507             variant_id => 111,
11508             variant => 'valencia',
11509             status => 'regular',
11510             }
11511              
11512             Returns an hash reference of a variant information from the table L<variants|/"Table variants"> based on the C<variant> ID provided.
11513              
11514             The meaning of the fields are as follows:
11515              
11516             =over 4
11517              
11518             =item * C<variant_id>
11519              
11520             A unique incremental value automatically generated by SQLite.
11521              
11522             =item * C<variant>
11523              
11524             A C<variant> ID
11525              
11526             =item * C<status>
11527              
11528             A string representing a status for this variant.
11529              
11530             Known values are: C<undef>, C<deprecated>, C<regular>
11531              
11532             =back
11533              
11534             =head2 variants
11535              
11536             my $all = $cldr->variants;
11537              
11538             Returns all the variants information as an array reference of hash reference from the L<table variants|/"Table variants">
11539              
11540             No additional parameter is needed.
11541              
11542             =head2 variant_l10n
11543              
11544             my $ref = $cldr->variant_l10n(
11545             variant => 'valencia',
11546             locale => 'en',
11547             alt => undef,
11548             );
11549             # Returns an hash reference like this:
11550             {
11551             var_l10n_id => 771,
11552             locale => 'en',
11553             variant => 'valencia',
11554             locale_name => 'Valencian',
11555             alt => undef,
11556             }
11557              
11558             Returns an hash reference of a C<variant> localised information from the table L<variants_l10n|/"Table variants_l10n"> for a given C<variant> ID and a C<locale> ID and an C<alt> value. If no C<alt> value is provided, it will default to C<undef>
11559              
11560             The meaning of the fields are as follows:
11561              
11562             =over 4
11563              
11564             =item * C<var_l10n_id>
11565              
11566             A unique incremental value automatically generated by SQLite.
11567              
11568             =item * C<locale>
11569              
11570             A C<locale>, such as C<en> or C<ja-JP> as can be found in table L<locales|/"Table locales">
11571              
11572             =item * C<variant>
11573              
11574             A C<variant> ID as can be found in the L<table variants|/"Table variants">
11575              
11576             =item * C<locale_name>
11577              
11578             A string representing the localised C<variant> name based on the C<locale>
11579              
11580             =item * C<alt>
11581              
11582             An alternative value identifier to distinguish a variant with the same name.
11583              
11584             Known values are: C<undef> and C<secondary>
11585              
11586             =back
11587              
11588             =head2 variants_l10n
11589              
11590             my $all = $cldr->variants_l10n;
11591             my $all = $cldr->variants_l10n( locale => 'en' );
11592             my $all = $cldr->variants_l10n(
11593             locale => 'en',
11594             alt => undef,
11595             );
11596              
11597             Returns all the variants localised information as an array reference of hash reference from the L<table variants_l10n|/"Table variants_l10n">
11598              
11599             =head2 week_preference
11600              
11601             my $ref = $cldr->week_preference( locale => 'ja' );
11602             # Returns an hash reference like this:
11603             {
11604             week_pref_id => 32,
11605             locale => 'ja',
11606             ordering => ["weekOfDate", "weekOfMonth"],
11607             }
11608              
11609             Returns an hash reference of a week preference information from the table L<week_preferences|/"Table week_preferences"> for a given C<locale> ID.
11610              
11611             The meaning of the fields are as follows:
11612              
11613             =over 4
11614              
11615             =item * C<week_pref_id>
11616              
11617             A unique incremental value automatically generated by SQLite.
11618              
11619             =item * C<locale>
11620              
11621             A C<locale>, such as C<en> or C<ja-JP> as can be found in table L<locales|/"Table locales">
11622              
11623             =item * C<ordering>
11624              
11625             This is "an ordered list of the preferred types of week designations for that"[L<1|https://unicode.org/reports/tr35/tr35-dates.html#Week_Data>]
11626              
11627             It is provided as an array of tokens.
11628              
11629             Known values in the array are:
11630              
11631             =over 8
11632              
11633             =item * C<weekOfYear>
11634              
11635             =item * C<weekOfMonth>
11636              
11637             =item * C<weekOfDate>
11638              
11639             =item * C<weekOfInterval>
11640              
11641             =back
11642              
11643             =back
11644              
11645             See the L<LDML specifications|https://unicode.org/reports/tr35/tr35-dates.html#Week_Data> for more information.
11646              
11647             =head2 week_preferences
11648              
11649             my $all = $cldr->week_preferences;
11650              
11651             Returns all the week preferences information as an array reference of hash reference from the L<table week_preferences|/"Table week_preferences">
11652              
11653             =head1 Format Patterns
11654              
11655             The following is taken directly from the L<Unicode LDML specifications|https://unicode.org/reports/tr35/tr35-dates.html#table-date-field-symbol-table> and placed here for your convenience.
11656              
11657             See also the L<ICU format patterns table|https://unicode-org.github.io/icu/userguide/format_parse/datetime/#date-field-symbol-table>.
11658              
11659             Examples:
11660              
11661             =over 4
11662              
11663             =item * C<yyyy.MM.dd G 'at' HH:mm:ss zzz>
11664              
11665             1996.07.10 AD at 15:08:56 PDT
11666              
11667             =item * C<EEE, MMM d, ''yy>
11668              
11669             Wed, July 10, '96
11670              
11671             =item * C<h:mm a>
11672              
11673             12:08 PM
11674              
11675             =item * C<hh 'o''clock' a, zzzz>
11676              
11677             12 o'clock PM, Pacific Daylight Time
11678              
11679             =item * C<K:mm a, z>
11680              
11681             0:00 PM, PST
11682              
11683             =item * C<yyyyy.MMMM.dd GGG hh:mm aaa>
11684              
11685             01996.July.10 AD 12:08 PM
11686              
11687             =back
11688              
11689             See the L<date field symbols table|https://unicode.org/reports/tr35/tr35-dates.html#Date_Field_Symbol_Table> for more details.
11690              
11691             =over 4
11692              
11693             =item * C<a> period
11694              
11695             B<AM, PM>
11696              
11697             May be upper or lowercase depending on the locale and other options. The wide form may be the same as the short form if the “real” long form (eg ante meridiem) is not customarily used. The narrow form must be unique, unlike some other fields. See also Parsing Dates and Times.
11698              
11699             Examples:
11700              
11701             =over 8
11702              
11703             =item * C<a..aaa> (Abbreviated)
11704              
11705             am. [e.g. 12 am.]
11706              
11707             =item * C<aaaa> (Wide)
11708              
11709             am. [e.g. 12 am.]
11710              
11711             =item * C<aaaaa> (Narrow)
11712              
11713             a [e.g. 12a]
11714              
11715             =back
11716              
11717             =item * C<A> second
11718              
11719             Milliseconds in day (numeric). This field behaves exactly like a composite of all time-related fields, not including the zone fields. As such, it also reflects discontinuities of those fields on DST transition days. On a day of DST onset, it will jump forward. On a day of DST cessation, it will jump backward. This reflects the fact that it must be combined with the offset field to obtain a unique local time value. The field length specifies the minimum number of digits, with zero-padding as necessary.
11720              
11721             Examples:
11722              
11723             =over 8
11724              
11725             =item * C<A+>
11726              
11727             69540000
11728              
11729             =back
11730              
11731             =item * C<b> period
11732              
11733             B<am, pm, noon, midnight>
11734              
11735             May be upper or lowercase depending on the locale and other options. If the locale doesn't have the notion of a unique "noon" = 12:00, then the PM form may be substituted. Similarly for "midnight" = 00:00 and the AM form. The narrow form must be unique, unlike some other fields.
11736              
11737             Examples:
11738              
11739             =over 8
11740              
11741             =item * C<b..bbb> (Abbreviated)
11742              
11743             mid. [e.g. 12 mid.]
11744              
11745             =item * C<bbbb> (Wide)
11746              
11747             midnight
11748              
11749             [e.g. 12 midnight]
11750              
11751             =item * C<bbbbb> (Narrow)
11752              
11753             md [e.g. 12 md]
11754              
11755             =back
11756              
11757             =item * C<B> period
11758              
11759             B<flexible day periods>
11760              
11761             May be upper or lowercase depending on the locale and other options. Often there is only one width that is customarily used.
11762              
11763             Examples:
11764              
11765             =over 8
11766              
11767             =item * C<B..BBB> (Abbreviated)
11768              
11769             at night
11770              
11771             [e.g. 3:00 at night]
11772              
11773             =item * C<BBBB> (Wide)
11774              
11775             at night
11776              
11777             [e.g. 3:00 at night]
11778              
11779             =item * C<BBBBB> (Narrow)
11780              
11781             at night
11782              
11783             [e.g. 3:00 at night]
11784              
11785             =back
11786              
11787             =item * C<c> week day
11788              
11789             Stand-Alone local day of week number/name.
11790              
11791             Examples:
11792              
11793             =over 8
11794              
11795             =item * C<c..cc>
11796              
11797             2
11798              
11799             Numeric: 1 digit
11800              
11801             =item * C<ccc> (Abbreviated)
11802              
11803             Tue
11804              
11805             =item * C<cccc> (Wide)
11806              
11807             Tuesday
11808              
11809             =item * C<ccccc> (Narrow)
11810              
11811             T
11812              
11813             =item * C<cccccc> (Short)
11814              
11815             Tu
11816              
11817             =back
11818              
11819             =item * C<C>
11820              
11821             B<Input skeleton symbol>
11822              
11823             It must not occur in pattern or skeleton data. Instead, it is reserved for use in skeletons passed to APIs doing flexible date pattern generation. In such a context, like 'j', it requests the preferred hour format for the locale. However, unlike 'j', it can also select formats such as hb or hB, since it is based not on the preferred attribute of the hours element in supplemental data, but instead on the first element of the allowed attribute (which is an ordered preferrence list). For example, with "Cmm", 18:00 could appear as “6:00 in the afternoon”.
11824              
11825             Example:
11826              
11827             =over 8
11828              
11829             =item * C<C>
11830              
11831             C<8>
11832              
11833             C<8> (morning)
11834              
11835             Numeric hour (minimum digits), abbreviated dayPeriod if used
11836              
11837             =item * C<CC>
11838              
11839             C<08>
11840              
11841             C<08> (morning)
11842              
11843             Numeric hour (2 digits, zero pad if needed), abbreviated dayPeriod if used
11844              
11845             =item * C<CCC>
11846              
11847             C<8>
11848              
11849             C<8> in the morning
11850              
11851             Numeric hour (minimum digits), wide dayPeriod if used
11852              
11853             =item * C<CCCC>
11854              
11855             C<08>
11856              
11857             C<08> in the morning
11858              
11859             Numeric hour (2 digits, zero pad if needed), wide dayPeriod if used
11860              
11861             =item * C<CCCCC>
11862              
11863             C<8>
11864              
11865             C<8> (morn.)
11866              
11867             Numeric hour (minimum digits), narrow dayPeriod if used
11868              
11869             =item * C<CCCCCC>
11870              
11871             C<08>
11872              
11873             C<08> (morn.)
11874              
11875             Numeric hour (2 digits, zero pad if needed), narrow dayPeriod if used
11876              
11877             =back
11878              
11879             =item * C<d> day of month
11880              
11881             Day of month (numeric).
11882              
11883             Example:
11884              
11885             =over 8
11886              
11887             =item * C<d>
11888              
11889             1
11890              
11891             Numeric: minimum digits
11892              
11893             =item * C<dd>
11894              
11895             01
11896              
11897             Numeric: 2 digits, zero pad if needed
11898              
11899             =back
11900              
11901             =item * C<D> day of year
11902              
11903             The field length specifies the minimum number of digits, with zero-padding as necessary.
11904              
11905             Example:
11906              
11907             =over 8
11908              
11909             =item * C<D...DDD> day
11910              
11911             345 Day of year (numeric).
11912              
11913             =back
11914              
11915             =item * C<e> week day
11916              
11917             Local day of week number/name, format style. Same as E except adds a numeric value that will depend on the local starting day of the week. For this example, Monday is the first day of the week.
11918              
11919             Example:
11920              
11921             =over 8
11922              
11923             =item * C<e>
11924              
11925             2
11926              
11927             Numeric: 1 digit
11928              
11929             =item * C<ee>
11930              
11931             02
11932              
11933             Numeric: 2 digits + zero pad
11934              
11935             =item * C<eee> (Abbreviated)
11936              
11937             Tue
11938              
11939             =item * C<eeee> (Wide)
11940              
11941             Tuesday
11942              
11943             =item * C<eeeee> (Narrow)
11944              
11945             T
11946              
11947             =item * C<eeeeee> (Short)
11948              
11949             Tu
11950              
11951             =back
11952              
11953             =item * C<E> week day
11954              
11955             Day of week name, format style.
11956              
11957             Example:
11958              
11959             =over 8
11960              
11961             =item * C<E..EEE> (Abbreviated)
11962              
11963             Tue
11964              
11965             =item * C<EEEE> (Wide)
11966              
11967             Tuesday
11968              
11969             =item * C<EEEEE> (Narrow)
11970              
11971             T
11972              
11973             =item * C<EEEEEE> (Short)
11974              
11975             Tu
11976              
11977             =back
11978              
11979             =item * C<F> day
11980              
11981             Day of Week in Month (numeric). The example is for the 2nd Wed in July
11982              
11983             Example:
11984              
11985             =over 8
11986              
11987             =item * C<F>
11988              
11989             2
11990              
11991             =back
11992              
11993             =item * C<g>
11994              
11995             Modified Julian day (numeric). This is different from the conventional Julian day number in two regards. First, it demarcates days at local zone midnight, rather than noon GMT. Second, it is a local number; that is, it depends on the local time zone. It can be thought of as a single number that encompasses all the date-related fields. The field length specifies the minimum number of digits, with zero-padding as necessary.
11996              
11997             Example:
11998              
11999             =over 8
12000              
12001             =item * C<g+>
12002              
12003             2451334
12004              
12005             =back
12006              
12007             =item * C<G> era
12008              
12009             Era name.
12010              
12011             Example:
12012              
12013             =over 8
12014              
12015             =item * C<G..GGG> (Abbreviated)
12016              
12017             AD
12018              
12019             [variant: CE]
12020              
12021             =item * C<GGGG> (Wide)
12022              
12023             Anno Domini
12024              
12025             [variant: Common Era]
12026              
12027             =item * C<GGGGG> (Narrow)
12028              
12029             A
12030              
12031             =back
12032              
12033             =item * C<h> hour
12034              
12035             Hour [1-12]. When used in skeleton data or in a skeleton passed in an API for flexible date pattern generation, it should match the 12-hour-cycle format preferred by the locale (h or K); it should not match a 24-hour-cycle format (H or k).
12036              
12037             Example:
12038              
12039             =over 8
12040              
12041             =item * C<h>
12042              
12043             1, 12
12044              
12045             Numeric: minimum digits
12046              
12047             =item * C<hh>
12048              
12049             01, 12
12050              
12051             Numeric: 2 digits, zero pad if needed
12052              
12053             =back
12054              
12055             =item * C<H> hour
12056              
12057             Hour [0-23]. When used in skeleton data or in a skeleton passed in an API for flexible date pattern generation, it should match the 24-hour-cycle format preferred by the locale (H or k); it should not match a 12-hour-cycle format (h or K).
12058              
12059             Example:
12060              
12061             =over 8
12062              
12063             =item * C<H>
12064              
12065             C<0>, C<23>
12066              
12067             Numeric: minimum digits
12068              
12069             =item * C<HH>
12070              
12071             C<00>, C<23>
12072              
12073             Numeric: 2 digits, zero pad if needed
12074              
12075             =back
12076              
12077             =item * C<j>
12078              
12079             B<Input skeleton symbol>
12080              
12081             It must not occur in pattern or skeleton data. Instead, it is reserved for use in skeletons passed to APIs doing flexible date pattern generation. In such a context, it requests the preferred hour format for the locale (h, H, K, or k), as determined by the preferred attribute of the hours element in supplemental data. In the implementation of such an API, 'j' must be replaced by h, H, K, or k before beginning a match against availableFormats data.
12082              
12083             Note that use of 'j' in a skeleton passed to an API is the only way to have a skeleton request a locale's preferred time cycle type (12-hour or 24-hour).
12084              
12085             Example:
12086              
12087             =over 8
12088              
12089             =item * C<j>
12090              
12091             C<8>
12092              
12093             C<8 AM>
12094              
12095             C<13>
12096              
12097             C<1 PM>
12098              
12099             Numeric hour (minimum digits), abbreviated dayPeriod if used
12100              
12101             =item * C<jj>
12102              
12103             C<08>
12104              
12105             C<08 AM>
12106              
12107             C<13>
12108              
12109             C<01 PM>
12110              
12111             Numeric hour (2 digits, zero pad if needed), abbreviated dayPeriod if used
12112              
12113             =item * C<jjj>
12114              
12115             C<8>
12116              
12117             C<8 A.M.>
12118              
12119             C<13>
12120              
12121             C<1 P.M.>
12122              
12123             Numeric hour (minimum digits), wide dayPeriod if used
12124              
12125             =item * C<jjjj>
12126              
12127             C<08>
12128              
12129             C<08 A.M.>
12130              
12131             C<13>
12132              
12133             C<01 P.M.>
12134              
12135             Numeric hour (2 digits, zero pad if needed), wide dayPeriod if used
12136              
12137             =item * C<jjjjj>
12138              
12139             C<8>
12140              
12141             C<8a>
12142              
12143             C<13>
12144              
12145             C<1p>
12146              
12147             Numeric hour (minimum digits), narrow dayPeriod if used
12148              
12149             =item * C<jjjjjj>
12150              
12151             C<08>
12152              
12153             C<08a>
12154              
12155             C<13>
12156              
12157             C<01p>
12158              
12159             Numeric hour (2 digits, zero pad if needed), narrow dayPeriod if used
12160              
12161             =back
12162              
12163             =item * C<J>
12164              
12165             B<Input skeleton symbol>
12166              
12167             It must not occur in pattern or skeleton data. Instead, it is reserved for use in skeletons passed to APIs doing flexible date pattern generation. In such a context, like 'j', it requests the preferred hour format for the locale (h, H, K, or k), as determined by the B<preferred> attribute of the hours element in supplemental data. However, unlike 'j', it requests no dayPeriod marker such as “am/pm” (it is typically used where there is enough context that that is not necessary). For example, with "jmm", 18:00 could appear as “6:00 PM”, while with "Jmm", it would appear as “6:00” (no PM).
12168              
12169             Example:
12170              
12171             =over 8
12172              
12173             =item * C<J>
12174              
12175             C<8>
12176              
12177             C<8>
12178              
12179             Numeric hour (minimum digits)
12180              
12181             =item * C<JJ>
12182              
12183             C<08>
12184              
12185             C<08>
12186              
12187             Numeric hour (2 digits, zero pad if needed)
12188              
12189             =back
12190              
12191             =item * C<k> hour
12192              
12193             Hour [1-24]. When used in a skeleton, only matches k or H, see above.
12194              
12195             Example:
12196              
12197             =over 8
12198              
12199             =item * C<k>
12200              
12201             C<1>, C<24>
12202              
12203             Numeric: minimum digits
12204              
12205             =item * C<kk>
12206              
12207             C<01>, C<24>
12208              
12209             Numeric: 2 digits, zero pad if needed
12210              
12211             =back
12212              
12213             =item * C<K> hour
12214              
12215             Hour [0-11]. When used in a skeleton, only matches K or h, see above.
12216              
12217             Example:
12218              
12219             =over 8
12220              
12221             =item * C<K>
12222              
12223             0, 11
12224              
12225             Numeric: minimum digits
12226              
12227             =item * C<KK>
12228              
12229             00, 11
12230              
12231             Numeric: 2 digits, zero pad if needed
12232              
12233             =back
12234              
12235             =item * C<L> month
12236              
12237             Stand-Alone month number/name: For use when the month is displayed by itself, and in any other date pattern (e.g. just month and year, e.g. "LLLL y") that shares the same form of the month name. For month names, this is typically the nominative form. See discussion of month element.
12238              
12239             See also the symbol C<M> for month.
12240              
12241             Example:
12242              
12243             =over 8
12244              
12245             =item * C<L>
12246              
12247             9, 12
12248              
12249             Numeric: minimum digits
12250              
12251             =item * C<LL>
12252              
12253             09, 12 Numeric: 2 digits, zero pad if needed
12254              
12255             =item * C<LLL> (Abbreviated)
12256              
12257             Sep
12258              
12259             =item * C<LLLL> (Wide)
12260              
12261             September
12262              
12263             =item * C<LLLLL> (Narrow)
12264              
12265             S
12266              
12267             =back
12268              
12269             =item * C<M> month
12270              
12271             Numeric: minimum digits Format style month number/name: The format style name is an additional form of the month name (besides the stand-alone style) that can be used in contexts where it is different than the stand-alone form. For example, depending on the language, patterns that combine month with day-of month (e.g. "d MMMM") may require the month to be in genitive form. See discussion of month element. If a separate form is not needed, the format and stand-alone forms can be the same.
12272              
12273             See also C<L>
12274              
12275             Example:
12276              
12277             =over 8
12278              
12279             =item * C<M>
12280              
12281             9, 12
12282              
12283             =item * C<MM>
12284              
12285             09, 12 Numeric: 2 digits, zero pad if needed
12286              
12287             =item * C<MMM> (Abbreviated)
12288              
12289             Sep
12290              
12291             =item * C<MMMM> (Wide)
12292              
12293             September
12294              
12295             =item * C<MMMMM> (Narrow)
12296              
12297             S
12298              
12299             =back
12300              
12301             =item * C<m> minute
12302              
12303             Minute (numeric). Truncated, not rounded.
12304              
12305             Examples:
12306              
12307             =over 8
12308              
12309             =item * C<m>
12310              
12311             C<8>, C<59>
12312              
12313             Numeric: minimum digits
12314              
12315             =item * C<mm>
12316              
12317             C<08>, C<59>
12318              
12319             Numeric: 2 digits, zero pad if needed
12320              
12321             =back
12322              
12323             =item * C<O> zone
12324              
12325             Examples:
12326              
12327             =over 8
12328              
12329             =item * C<O>
12330              
12331             C<GMT-8>
12332              
12333             The short localized GMT format.
12334              
12335             =item * C<OOOO>
12336              
12337             C<GMT-08:00>
12338              
12339             The long localized GMT format.
12340              
12341             =back
12342              
12343             =item * C<q> quarter
12344              
12345             Stand-Alone Quarter number/name.
12346              
12347             Examples:
12348              
12349             =over 8
12350              
12351             =item * C<q>
12352              
12353             C<2>
12354              
12355             Numeric: 1 digit
12356              
12357             =item * C<qq>
12358              
12359             C<02>
12360              
12361             Numeric: 2 digits + zero pad
12362              
12363             =item * C<qqq> (Abbreviated)
12364              
12365             C<Q2>
12366              
12367             =item * C<qqqq> (Wide)
12368              
12369             C<2nd quarter>
12370              
12371             =item * C<qqqqq> (Narrow)
12372              
12373             C<2>
12374              
12375             =back
12376              
12377             =item * C<Q> quarter
12378              
12379             Quarter number/name.
12380              
12381             Examples:
12382              
12383             =over 8
12384              
12385             =item * C<Q>
12386              
12387             C<2>
12388              
12389             Numeric: 1 digit
12390              
12391             =item * C<QQ>
12392              
12393             C<02>
12394              
12395             Numeric: 2 digits + zero pad
12396              
12397             =item * C<QQQ> (Abbreviated)
12398              
12399             C<Q2>
12400              
12401             =item * C<QQQQ> (Wide)
12402              
12403             C<2nd quarter>
12404              
12405             =item * C<QQQQQ> (Narrow)
12406              
12407             C<2>
12408              
12409             =back
12410              
12411             =item * C<r>
12412              
12413             Related Gregorian year (numeric). For non-Gregorian calendars, this corresponds to the extended Gregorian year in which the calendar’s year begins. Related Gregorian years are often displayed, for example, when formatting dates in the Japanese calendar — e.g. “2012(平成24)年1月15日” — or in the Chinese calendar — e.g. “2012壬辰年腊月初四”. The related Gregorian year is usually displayed using the "latn" numbering system, regardless of what numbering systems may be used for other parts of the formatted date. If the calendar’s year is linked to the solar year (perhaps using leap months), then for that calendar the ‘r’ year will always be at a fixed offset from the ‘u’ year. For the Gregorian calendar, the ‘r’ year is the same as the ‘u’ year. For ‘r’, all field lengths specify a minimum number of digits; there is no special interpretation for “rr”.
12414              
12415             Example:
12416              
12417             =over 8
12418              
12419             =item * C<r+>
12420              
12421             C<2017>
12422              
12423             =back
12424              
12425             =item * C<s> second
12426              
12427             Second (numeric). Truncated, not rounded.
12428              
12429             Example:
12430              
12431             =over 8
12432              
12433             =item * C<s>
12434              
12435             C<8>, C<12>
12436              
12437             Numeric: minimum digits
12438              
12439             =item * C<ss>
12440              
12441             C<08>, C<12>
12442              
12443             Numeric: 2 digits, zero pad if needed
12444              
12445             =back
12446              
12447             =item * C<S> second
12448              
12449             Fractional Second (numeric). Truncates, like other numeric time fields, but in this case to the number of digits specified by the field length. (Example shows display using pattern SSSS for seconds value 12.34567)
12450              
12451             Example:
12452              
12453             =over 8
12454              
12455             =item * C<S+>
12456              
12457             3456
12458              
12459             =back
12460              
12461             =item * C<u>
12462              
12463             Extended year (numeric). This is a single number designating the year of this calendar system, encompassing all supra-year fields. For example, for the Julian calendar system, year numbers are positive, with an era of BCE or CE. An extended year value for the Julian calendar system assigns positive values to CE years and negative values to BCE years, with 1 BCE being year 0. For ‘u’, all field lengths specify a minimum number of digits; there is no special interpretation for “uu”.
12464              
12465             Example:
12466              
12467             =over 8
12468              
12469             =item * C<u+>
12470              
12471             C<4601>
12472              
12473             =back
12474              
12475             =item * C<U>
12476              
12477             Cyclic year name. Calendars such as the Chinese lunar calendar (and related calendars) and the Hindu calendars use 60-year cycles of year names. If the calendar does not provide cyclic year name data, or if the year value to be formatted is out of the range of years for which cyclic name data is provided, then numeric formatting is used (behaves like 'y').
12478              
12479             Currently the data only provides abbreviated names, which will be used for all requested name widths.
12480              
12481             Example:
12482              
12483             =over 8
12484              
12485             =item * C<U..UUU> (Abbreviated)
12486              
12487             C<甲子>
12488              
12489             =item * C<UUUU> (Wide)
12490              
12491             C<甲子> [for now]
12492              
12493             =item * C<UUUUU> (Narrow)
12494              
12495             C<甲子> [for now]
12496              
12497             =back
12498              
12499             =item * C<v> zone
12500              
12501             Example:
12502              
12503             =over 8
12504              
12505             =item * C<v>
12506              
12507             C<PT>
12508              
12509             The short generic non-location format Where that is unavailable, falls back to the generic location format ("VVVV"), then the short localized GMT format as the final fallback.
12510              
12511             =item * C<vvvv>
12512              
12513             C<Pacific Time>
12514              
12515             The long generic non-location format. Where that is unavailable, falls back to generic location format ("VVVV").
12516              
12517             =back
12518              
12519             =item * C<V> zone
12520              
12521             Example:
12522              
12523             =over 8
12524              
12525             =item * C<V>
12526              
12527             C<uslax>
12528              
12529             The short time zone ID. Where that is unavailable, the special short time zone ID unk (Unknown Zone) is used.
12530             Note: This specifier was originally used for a variant of the short specific non-location format, but it was deprecated in the later version of this specification. In CLDR 23, the definition of the specifier was changed to designate a short time zone ID.
12531              
12532             =item * C<VV>
12533              
12534             C<America/Los_Angeles>
12535              
12536             The long time zone ID.
12537              
12538             =item * C<VVV>
12539              
12540             C<Los Angeles>
12541              
12542             The exemplar city (location) for the time zone. Where that is unavailable, the localized exemplar city name for the special zone Etc/Unknown is used as the fallback (for example, "Unknown City").
12543              
12544             =item * C<VVVV>
12545              
12546             C<Los Angeles Time>
12547              
12548             The generic location format. Where that is unavailable, falls back to the long localized GMT format ("OOOO"; Note: Fallback is only necessary with a GMT-style Time Zone ID, like Etc/GMT-830.)
12549              
12550             This is especially useful when presenting possible timezone choices for user selection, since the naming is more uniform than the "v" format.
12551              
12552             =back
12553              
12554             =item * C<w>
12555              
12556             Week of Year (numeric). When used in a pattern with year, use ‘Y’ for the year field instead of ‘y’.
12557              
12558             Example:
12559              
12560             =over 8
12561              
12562             =item * C<w>
12563              
12564             C<8>, C<27>
12565              
12566             Numeric: minimum digits
12567              
12568             =item * C<ww>
12569              
12570             C<08>, C<27>
12571              
12572             Numeric: 2 digits, zero pad if needed
12573              
12574             =back
12575              
12576             =item * C<W>
12577              
12578             Week of Month (numeric)
12579              
12580             Example:
12581              
12582             =over 8
12583              
12584             =item * C<W>
12585              
12586             C<3>
12587              
12588             Numeric: 1 digit
12589              
12590             =back
12591              
12592             =item * C<x> zone
12593              
12594             Example:
12595              
12596             =over 8
12597              
12598             =item * C<x>
12599              
12600             C<-08>
12601              
12602             C<+0530>
12603              
12604             C<+00>
12605              
12606             The ISO8601 basic format with hours field and optional minutes field. (The same as X, minus "Z".)
12607              
12608             =item * C<xx>
12609              
12610             C<-0800>
12611              
12612             C<+0000>
12613              
12614             The ISO8601 basic format with hours and minutes fields. (The same as XX, minus "Z".)
12615              
12616             =item * C<xxx>
12617              
12618             C<-08:00>
12619              
12620             C<+00:00>
12621              
12622             The ISO8601 extended format with hours and minutes fields. (The same as XXX, minus "Z".)
12623              
12624             =item * C<xxxx>
12625              
12626             C<-0800>
12627              
12628             C<-075258>
12629              
12630             C<+0000>
12631              
12632             The ISO8601 basic format with hours, minutes and optional seconds fields. (The same as XXXX, minus "Z".)
12633              
12634             Note: The seconds field is not supported by the ISO8601 specification.
12635              
12636             =item * C<xxxxx>
12637              
12638             C<-08:00>
12639              
12640             C<-07:52:58>
12641              
12642             C<+00:00>
12643              
12644             The ISO8601 extended format with hours, minutes and optional seconds fields. (The same as XXXXX, minus "Z".)
12645              
12646             Note: The seconds field is not supported by the ISO8601 specification.
12647              
12648             =back
12649              
12650             =item * C<X> zone
12651              
12652             Example:
12653              
12654             =over 8
12655              
12656             =item * C<X>
12657              
12658             C<-08>
12659              
12660             C<+0530>
12661              
12662             C<Z>
12663              
12664             The ISO8601 basic format with hours field and optional minutes field. The ISO8601 UTC indicator "Z" is used when local time offset is 0. (The same as x, plus "Z".)
12665              
12666             =item * C<XX>
12667              
12668             C<-0800>
12669              
12670             C<Z>
12671              
12672             The ISO8601 basic format with hours and minutes fields. The ISO8601 UTC indicator "Z" is used when local time offset is 0. (The same as xx, plus "Z".)
12673              
12674             =item * C<XXX>
12675              
12676             C<-08:00>
12677              
12678             C<Z>
12679              
12680             The ISO8601 extended format with hours and minutes fields. The ISO8601 UTC indicator "Z" is used when local time offset is 0. (The same as xxx, plus "Z".)
12681              
12682             =item * C<XXXX>
12683              
12684             C<-0800>
12685              
12686             C<-075258>
12687              
12688             C<Z>
12689              
12690             The ISO8601 basic format with hours, minutes and optional seconds fields. The ISO8601 UTC indicator "Z" is used when local time offset is 0. (The same as xxxx, plus "Z".)
12691              
12692             Note: The seconds field is not supported by the ISO8601 specification.
12693              
12694             =item * C<XXXXX>
12695              
12696             C<-08:00>
12697              
12698             C<-07:52:58>
12699              
12700             C<Z>
12701              
12702             The ISO8601 extended format with hours, minutes and optional seconds fields. The ISO8601 UTC indicator "Z" is used when local time offset is 0. (The same as xxxxx, plus "Z".)
12703              
12704             Note: The seconds field is not supported by the ISO8601 specification.
12705              
12706             =back
12707              
12708             =item * C<y>
12709              
12710             Calendar year (numeric). In most cases the length of the y field specifies the minimum number of digits to display, zero-padded as necessary; more digits will be displayed if needed to show the full year. However, “yy” requests just the two low-order digits of the year, zero-padded as necessary. For most use cases, “y” or “yy” should be adequate.
12711              
12712             Example:
12713              
12714             =over 8
12715              
12716             =item * C<y>
12717              
12718             C<2>, C<20>, C<201>, C<2017>, C<20173>
12719              
12720             =item * C<yy>
12721              
12722             C<02>, C<20>, C<01>, C<17>, C<73>
12723              
12724             =item * C<yyy>
12725              
12726             C<002>, C<020>, C<201>, C<2017>, C<20173>
12727              
12728             =item * C<yyyy>
12729              
12730             C<0002>, C<0020>, C<0201>, C<2017>, C<20173>
12731              
12732             =item * C<yyyyy+>
12733              
12734             ...
12735              
12736             =back
12737              
12738             =item * C<Y>
12739              
12740             Year in “Week of Year” based calendars in which the year transition occurs on a week boundary; may differ from calendar year ‘y’ near a year transition. This numeric year designation is used in conjunction with pattern character ‘w’ in the ISO year-week calendar as defined by ISO 8601, but can be used in non-Gregorian based calendar systems where week date processing is desired. The field length is interpreted in the same was as for ‘y’; that is, “yy” specifies use of the two low-order year digits, while any other field length specifies a minimum number of digits to display.
12741              
12742             Example:
12743              
12744             =over 8
12745              
12746             =item * C<Y>
12747              
12748             C<2>, C<20>, C<201>, C<2017>, C<20173>
12749              
12750             =item * C<YY>
12751              
12752             C<02>, C<20>, C<01>, C<17>, C<73>
12753              
12754             =item * C<YYY>
12755              
12756             C<002>, C<020>, C<201>, C<2017>, C<20173>
12757              
12758             =item * C<YYYY>
12759              
12760             C<0002>, C<0020>, C<0201>, C<2017>, C<20173>
12761              
12762             =item * C<YYYYY+>
12763              
12764             ...
12765              
12766             =back
12767              
12768             =item * C<z> zone
12769              
12770             Examples:
12771              
12772             =over 8
12773              
12774             =item * C<z..zzz>
12775              
12776             C<PDT>
12777              
12778             The short specific non-location format. Where that is unavailable, falls back to the short localized GMT format ("O").
12779              
12780             =item * C<zzzz>
12781              
12782             C<Pacific Daylight Time>
12783              
12784             The long specific non-location format. Where that is unavailable, falls back to the long localized GMT format ("OOOO").
12785              
12786             =back
12787              
12788             =item * C<Z>
12789              
12790             Examples:
12791              
12792             =over 8
12793              
12794             =item * C<Z..ZZZ>
12795              
12796             C<-0800>
12797              
12798             The ISO8601 basic format with hours, minutes and optional seconds fields. The format is equivalent to RFC 822 zone format (when optional seconds field is absent). This is equivalent to the "xxxx" specifier.
12799              
12800             =item * C<ZZZZ>
12801              
12802             C<GMT-8:00>
12803              
12804             The long localized GMT format. This is equivalent to the "OOOO" specifier.
12805              
12806             =item * C<ZZZZZ>
12807              
12808             C<-08:00>
12809              
12810             C<-07:52:58>
12811              
12812             The ISO8601 extended format with hours, minutes and optional seconds fields. The ISO8601 UTC indicator "Z" is used when local time offset is 0. This is equivalent to the "XXXXX" specifier.
12813              
12814             =back
12815              
12816             =back
12817              
12818             See the L<LDML specifications|https://unicode.org/reports/tr35/tr35-dates.html#Date_Format_Patterns> for more information on the date and time formatting.
12819              
12820             =head1 Locale Inheritance
12821              
12822             When performing data look-ups, some data, such as width, may be missing and the default C<wide> should be used, and sometime, the data is aliased. For example, C<narrow> would be aliased to C<abbreviated>.
12823              
12824             Then, there is also a vertical inheritance, whereby a locale C<fr-CA> would lookup up data in its parent C<fr>. When the inheritance is not natural, the C<LDML> specifies a C<parent>. This information can be found in table L<locales|/"Table locales">. Ultimately, the root C<locale> with value C<und> is to be used.
12825              
12826             See the L<LDML specifications|https://unicode.org/reports/tr35/tr35.html#Parent_Locales> for more information.
12827              
12828             =head1 Errors
12829              
12830             This module does not die upon errors, unless you have set L<fatal|/fatal> to a true value. Instead it sets an L<error object|Locale::Unicode::Data::Exception> that can be retrieved.
12831              
12832             When an error occurred, an L<error object|Locale::Unicode::Data::Exception> will be set and the method will return C<undef> in scalar context and an empty list in list context.
12833              
12834             Otherwise, the only occasions when this module will die is when there is an internal design error, which would be my fault.
12835              
12836             =head1 Advanced Search
12837              
12838             You can specify an operator other than the default C<=> when providing arguments values, by placing it just before the argument value.
12839              
12840             Possible explicit operators are:
12841              
12842             =over 4
12843              
12844             =item * C<=>
12845              
12846             =item * C<!=>
12847              
12848             =item * C<< < >>
12849              
12850             =item * C<< <= >>
12851              
12852             =item * C<< > >>
12853              
12854             =item * C<< >= >>
12855              
12856             =item * C<~>
12857              
12858             Will enable the use of regular expression.
12859              
12860             Alternatively, you can use a perl regular expression using the perl operator L<qr|perlop/"Regexp Quote-Like Operators">
12861              
12862             =back
12863              
12864             For example:
12865              
12866             my $all = $cldr->timezone_info(
12867             timezone => 'Europe/Simferopol',
12868             start => ['>1991-01-01','<1995-01-01'],
12869             );
12870              
12871             This would result in:
12872              
12873             {
12874             tzinfo_id => 594,
12875             timezone => 'Europe/Simferopol',
12876             metazone => 'Moscow',
12877             start => '1994-04-30T21:00:00',
12878             until => '1997-03-30T01:00:00',
12879             }
12880              
12881             or, using the C<~> operator:
12882              
12883             my $all = $cldr->time_formats(
12884             region => '~^U.*',
12885             );
12886             my $all = $cldr->time_formats(
12887             region => qr/^U.*/,
12888             );
12889              
12890             would result in:
12891              
12892             [
12893             {
12894             time_format_id => 141,
12895             region => "UA",
12896             territory => "UA",
12897             locale => undef,
12898             time_format => "H",
12899             time_allowed => [qw( H hB h )],
12900             },
12901             {
12902             time_format_id => 142,
12903             region => "UZ",
12904             territory => "UZ",
12905             locale => undef,
12906             time_format => "H",
12907             time_allowed => [qw( H hB h )],
12908             },
12909             {
12910             time_format_id => 155,
12911             region => "UG",
12912             territory => "UG",
12913             locale => undef,
12914             time_format => "H",
12915             time_allowed => [qw( hB hb H h )],
12916             },
12917             {
12918             time_format_id => 194,
12919             region => "UY",
12920             territory => "UY",
12921             locale => undef,
12922             time_format => "h",
12923             time_allowed => [qw( h H hB hb )],
12924             },
12925             {
12926             time_format_id => 226,
12927             region => "UM",
12928             territory => "UM",
12929             locale => undef,
12930             time_format => "h",
12931             time_allowed => [qw( h hb H hB )],
12932             },
12933             {
12934             time_format_id => 227,
12935             region => "US",
12936             territory => "US",
12937             locale => undef,
12938             time_format => "h",
12939             time_allowed => [qw( h hb H hB )],
12940             },
12941             ]
12942              
12943             For single result methods, i.e. the methods that only return an hash reference, you can provide an array reference instead of a regular string for the primary field you are trying to query. So, for example, using the example above with the C<timezone> info:
12944              
12945             my $all = $cldr->timezone_info(
12946             timezone => 'Europe/Simferopol',
12947             start => ['>1991-01-01','<1995-01-01'],
12948             );
12949              
12950             or, querying the L<calendar terms|/calendar_term>:
12951              
12952             my $all = $cldr->calendar_term(
12953             locale => 'und',
12954             calendar => 'gregorian',
12955             # format, stand-alone
12956             term_context => 'format',
12957             # abbreviated, narrow, wide
12958             term_width => 'abbreviated',
12959             term_name => [qw( am pm )],
12960             );
12961             # Returns an array reference like:
12962             [
12963             {
12964             cal_term_id => 23478,
12965             locale => 'und',
12966             calendar => 'gregorian',
12967             term_type => 'day_period',
12968             term_context => 'format',
12969             term_width => 'abbreviated',
12970             alt => undef,
12971             term_name => 'am',
12972             term_value => 'AM',
12973             },
12974             {
12975             cal_term_id => 23479,
12976             locale => 'und',
12977             calendar => 'gregorian',
12978             term_type => 'day_period',
12979             term_context => 'format',
12980             term_width => 'abbreviated',
12981             alt => undef,
12982             term_name => 'pm',
12983             term_value => 'PM',
12984             },
12985             ]
12986              
12987             Of course, instead of returning an hash reference, as it normally would, it will return an array reference of hash reference.
12988              
12989             You can check if a table field containing an array has a certain value. For example:
12990              
12991             my $all = $cldr->metazones(
12992             has => [territories => 'CA'],
12993             );
12994              
12995             This will return all metazone entries that have the array value C<CA> in the field C<territories>.
12996              
12997             You can specify more than one field:
12998              
12999             my $all = $cldr->metazones(
13000             has => [territories => 'CA', timezones => 'America/Chicago'],
13001             );
13002              
13003             You can also use an hash reference instead of an array reference:
13004              
13005             my $all = $cldr->metazones(
13006             has => {
13007             territories => 'CA',
13008             timezones => 'America/Chicago',
13009             },
13010             );
13011              
13012             And if the table contains only one array field, then you do not have tp specify the field name:
13013              
13014             my $all = $cldr->aliases(
13015             has => 'America/Toronto',
13016             );
13017              
13018             This will implicitly use the field C<replacement>. However, if there are more than one array field, and you do not specify which one, then an error will be triggered. For example:
13019              
13020             my $all = $cldr->metazones(
13021             has => 'CA',
13022             );
13023             say $cldr->error->message;
13024             # "There are 2 fields with array. You need to specify which one you want to check for value 'CA'"
13025              
13026             You can also ensure a certain order based on a field value. For example, you want to retrieve the C<day> terms using L<calendar_term|/calendar_term>, but the C<term_name> are string, and we want to ensure the results are sorted in this order: C<mon>, C<tue>, C<wed>, C<thu>, C<fri>, C<sat> and C<sun>
13027              
13028             my $terms = $cldr->calendar_terms(
13029             locale => 'en',
13030             calendar => 'gregorian',
13031             term_type => 'day',
13032             term_context => 'format',
13033             term_width => 'wide',
13034             order_by_value => [term_name => [qw( mon tue wed thu fri sat sun )]],
13035             );
13036             my @weekdays = map( $_->{term_name}, @$terms );
13037             # Monday, Tuesday, Wednesday, Thursday, Friday, Saturday, Sunday
13038              
13039             If we had wanted to put Sunday first, we would have done:
13040              
13041             my $terms = $cldr->calendar_terms(
13042             locale => 'en',
13043             calendar => 'gregorian',
13044             term_type => 'day',
13045             term_context => 'format',
13046             term_width => 'wide',
13047             order_by_value => [term_name => [qw( sun mon tue wed thu fri sat )]],
13048             );
13049              
13050             The parameter C<order_by_value> supersedes the parameter C<order> that may be provided.
13051              
13052             You can specify a particular data type to sort the values returned by SQLite, by providing the argument C<order>, such as:
13053              
13054             my $months = $cldr->calendar_terms(
13055             locale => 'en',
13056             calendar => 'gregorian',
13057             term_type => 'month',
13058             term_context => 'format',
13059             term_width => 'wide',
13060             order => [term_name => 'integer'],
13061             );
13062              
13063             or, alternatively, using an hash reference with a single key:
13064              
13065             my $months = $cldr->calendar_terms(
13066             locale => 'en',
13067             calendar => 'gregorian',
13068             term_type => 'month',
13069             term_context => 'format',
13070             term_width => 'wide',
13071             order => { term_name => 'integer' },
13072             );
13073             my @month_names = map( $_->{term_name}, @$months );
13074             # January, February, March, April, May, June, July, August, September, October, November, December
13075              
13076             =head1 SQL Schema
13077              
13078             The SQLite SQL schema is available in the file C<scripts/cldr-schema.sql>
13079              
13080             The data are populated into the SQLite database using the script located in C<scripts/create_database.pl> and the data accessible from L<https://github.com/unicode-org/cldr> or from L<https://cldr.unicode.org/index/downloads/>
13081              
13082             =head1 Tables
13083              
13084             The SQL schema used to create the SQLite database is available in the C<scripts> directory of this distribution in the file C<cldr-schema.sql>
13085              
13086             The tables used are as follows, in alphabetical order:
13087              
13088             =head2 Table aliases
13089              
13090             =over 4
13091              
13092             =item * C<alias_id>
13093              
13094             An integer field.
13095              
13096             =item * C<alias>
13097              
13098             A string field.
13099              
13100             =item * C<replacement>
13101              
13102             A string array field.
13103              
13104             =item * C<reason>
13105              
13106             A string field.
13107              
13108             =item * C<type>
13109              
13110             A string field.
13111              
13112             =item * C<comment>
13113              
13114             A string field.
13115              
13116             =back
13117              
13118             =head2 Table annotations
13119              
13120             =over 4
13121              
13122             =item * C<annotation_id>
13123              
13124             An integer field.
13125              
13126             =item * C<locale>
13127              
13128             A string field.
13129              
13130             =item * C<annotation>
13131              
13132             A string field.
13133              
13134             =item * C<defaults>
13135              
13136             A string array field.
13137              
13138             =item * C<tts>
13139              
13140             A string field.
13141              
13142             =back
13143              
13144             =head2 Table bcp47_currencies
13145              
13146             =over 4
13147              
13148             =item * C<bcp47_curr_id>
13149              
13150             An integer field.
13151              
13152             =item * C<currid>
13153              
13154             A string field.
13155              
13156             =item * C<code>
13157              
13158             A string field.
13159              
13160             =item * C<description>
13161              
13162             A string field.
13163              
13164             =item * C<is_obsolete>
13165              
13166             A boolean field.
13167              
13168             =back
13169              
13170             =head2 Table bcp47_extensions
13171              
13172             =over 4
13173              
13174             =item * C<bcp47_ext_id>
13175              
13176             An integer field.
13177              
13178             =item * C<category>
13179              
13180             A string field.
13181              
13182             =item * C<extension>
13183              
13184             A string field.
13185              
13186             =item * C<alias>
13187              
13188             A string field.
13189              
13190             =item * C<value_type>
13191              
13192             A string field.
13193              
13194             =item * C<description>
13195              
13196             A string field.
13197              
13198             =item * C<deprecated>
13199              
13200             A boolean field.
13201              
13202             =back
13203              
13204             =head2 Table bcp47_timezones
13205              
13206             =over 4
13207              
13208             =item * C<bcp47_tz_id>
13209              
13210             An integer field.
13211              
13212             =item * C<tzid>
13213              
13214             A string field.
13215              
13216             =item * C<alias>
13217              
13218             A string array field.
13219              
13220             =item * C<preferred>
13221              
13222             A string field.
13223              
13224             =item * C<description>
13225              
13226             A string field.
13227              
13228             =item * C<deprecated>
13229              
13230             A boolean field.
13231              
13232             =back
13233              
13234             =head2 Table bcp47_values
13235              
13236             =over 4
13237              
13238             =item * C<bcp47_value_id>
13239              
13240             An integer field.
13241              
13242             =item * C<category>
13243              
13244             A string field.
13245              
13246             =item * C<extension>
13247              
13248             A string field.
13249              
13250             =item * C<value>
13251              
13252             A string field.
13253              
13254             =item * C<description>
13255              
13256             A string field.
13257              
13258             =back
13259              
13260             =head2 Table calendar_append_formats
13261              
13262             =over 4
13263              
13264             =item * C<cal_append_fmt_id>
13265              
13266             An integer field.
13267              
13268             =item * C<locale>
13269              
13270             A string field.
13271              
13272             =item * C<calendar>
13273              
13274             A string field.
13275              
13276             =item * C<format_id>
13277              
13278             A string field.
13279              
13280             =item * C<format_pattern>
13281              
13282             A string field.
13283              
13284             =back
13285              
13286             =head2 Table calendar_available_formats
13287              
13288             =over 4
13289              
13290             =item * C<cal_avail_fmt_id>
13291              
13292             An integer field.
13293              
13294             =item * C<locale>
13295              
13296             A string field.
13297              
13298             =item * C<calendar>
13299              
13300             A string field.
13301              
13302             =item * C<format_id>
13303              
13304             A string field.
13305              
13306             =item * C<format_pattern>
13307              
13308             A string field.
13309              
13310             =item * C<count>
13311              
13312             A string field.
13313              
13314             =item * C<alt>
13315              
13316             A string field.
13317              
13318             =back
13319              
13320             =head2 Table calendar_cyclics_l10n
13321              
13322             =over 4
13323              
13324             =item * C<cal_int_fmt_id>
13325              
13326             An integer field.
13327              
13328             =item * C<locale>
13329              
13330             A string field.
13331              
13332             =item * C<calendar>
13333              
13334             A string field.
13335              
13336             =item * C<format_set>
13337              
13338             A string field.
13339              
13340             =item * C<format_type>
13341              
13342             A string field.
13343              
13344             =item * C<format_length>
13345              
13346             A string field.
13347              
13348             =item * C<format_id>
13349              
13350             An integer field.
13351              
13352             =item * C<format_pattern>
13353              
13354             A string field.
13355              
13356             =back
13357              
13358             =head2 Table calendar_datetime_formats
13359              
13360             =over 4
13361              
13362             =item * C<cal_dt_fmt_id>
13363              
13364             An integer field.
13365              
13366             =item * C<locale>
13367              
13368             A string field.
13369              
13370             =item * C<calendar>
13371              
13372             A string field.
13373              
13374             =item * C<format_length>
13375              
13376             A string field.
13377              
13378             =item * C<format_type>
13379              
13380             A string field.
13381              
13382             =item * C<format_pattern>
13383              
13384             A string field.
13385              
13386             =back
13387              
13388             =head2 Table calendar_eras
13389              
13390             =over 4
13391              
13392             =item * C<calendar_era_id>
13393              
13394             An integer field.
13395              
13396             =item * C<calendar>
13397              
13398             A string field.
13399              
13400             =item * C<sequence>
13401              
13402             An integer field.
13403              
13404             =item * C<code>
13405              
13406             A string field.
13407              
13408             =item * C<aliases>
13409              
13410             A string array field.
13411              
13412             =item * C<start>
13413              
13414             A date field.
13415              
13416             =item * C<until>
13417              
13418             A date field.
13419              
13420             =back
13421              
13422             =head2 Table calendar_eras_l10n
13423              
13424             =over 4
13425              
13426             =item * C<cal_era_l10n_id>
13427              
13428             An integer field.
13429              
13430             =item * C<locale>
13431              
13432             A string field.
13433              
13434             =item * C<calendar>
13435              
13436             A string field.
13437              
13438             =item * C<era_width>
13439              
13440             A string field.
13441              
13442             =item * C<era_id>
13443              
13444             A string field.
13445              
13446             =item * C<alt>
13447              
13448             A string field.
13449              
13450             =item * C<locale_name>
13451              
13452             A string field.
13453              
13454             =back
13455              
13456             =head2 Table calendar_formats_l10n
13457              
13458             =over 4
13459              
13460             =item * C<cal_fmt_l10n_id>
13461              
13462             An integer field.
13463              
13464             =item * C<locale>
13465              
13466             A string field.
13467              
13468             =item * C<calendar>
13469              
13470             A string field.
13471              
13472             =item * C<format_type>
13473              
13474             A string field.
13475              
13476             =item * C<format_length>
13477              
13478             A string field.
13479              
13480             =item * C<alt>
13481              
13482             A string field.
13483              
13484             =item * C<format_id>
13485              
13486             A string field.
13487              
13488             =item * C<format_pattern>
13489              
13490             A string field.
13491              
13492             =back
13493              
13494             =head2 Table calendar_interval_formats
13495              
13496             =over 4
13497              
13498             =item * C<cal_int_fmt_id>
13499              
13500             An integer field.
13501              
13502             =item * C<locale>
13503              
13504             A string field.
13505              
13506             =item * C<calendar>
13507              
13508             A string field.
13509              
13510             =item * C<format_id>
13511              
13512             A string field.
13513              
13514             =item * C<greatest_diff_id>
13515              
13516             A string field.
13517              
13518             =item * C<format_pattern>
13519              
13520             A string field.
13521              
13522             =item * C<alt>
13523              
13524             A string field.
13525              
13526             =item * C<part1>
13527              
13528             A string field.
13529              
13530             =item * C<separator>
13531              
13532             A string field.
13533              
13534             =item * C<part2>
13535              
13536             A string field.
13537              
13538             =item * C<repeating_field>
13539              
13540             A string field.
13541              
13542             =back
13543              
13544             =head2 Table calendar_terms
13545              
13546             =over 4
13547              
13548             =item * C<cal_term_id>
13549              
13550             An integer field.
13551              
13552             =item * C<locale>
13553              
13554             A string field.
13555              
13556             =item * C<calendar>
13557              
13558             A string field.
13559              
13560             =item * C<term_type>
13561              
13562             A string field.
13563              
13564             =item * C<term_context>
13565              
13566             A string field.
13567              
13568             =item * C<term_width>
13569              
13570             A string field.
13571              
13572             =item * C<alt>
13573              
13574             A string field.
13575              
13576             =item * C<yeartype>
13577              
13578             A string field.
13579              
13580             =item * C<term_name>
13581              
13582             A string field.
13583              
13584             =item * C<term_value>
13585              
13586             A string field.
13587              
13588             =back
13589              
13590             =head2 Table calendars
13591              
13592             =over 4
13593              
13594             =item * C<calendar_id>
13595              
13596             An integer field.
13597              
13598             =item * C<calendar>
13599              
13600             A string field.
13601              
13602             =item * C<system>
13603              
13604             A string field.
13605              
13606             =item * C<inherits>
13607              
13608             A string field.
13609              
13610             =item * C<description>
13611              
13612             A string field.
13613              
13614             =back
13615              
13616             =head2 Table calendars_l10n
13617              
13618             =over 4
13619              
13620             =item * C<calendar_l10n_id>
13621              
13622             An integer field.
13623              
13624             =item * C<locale>
13625              
13626             A string field.
13627              
13628             =item * C<calendar>
13629              
13630             A string field.
13631              
13632             =item * C<locale_name>
13633              
13634             A string field.
13635              
13636             =back
13637              
13638             =head2 Table casings
13639              
13640             =over 4
13641              
13642             =item * C<casing_id>
13643              
13644             An integer field.
13645              
13646             =item * C<locale>
13647              
13648             A string field.
13649              
13650             =item * C<token>
13651              
13652             A string field.
13653              
13654             =item * C<value>
13655              
13656             A string field.
13657              
13658             =back
13659              
13660             =head2 Table code_mappings
13661              
13662             =over 4
13663              
13664             =item * C<code_mapping_id>
13665              
13666             An integer field.
13667              
13668             =item * C<code>
13669              
13670             A string field.
13671              
13672             =item * C<alpha3>
13673              
13674             A string field.
13675              
13676             =item * C<numeric>
13677              
13678             An integer field.
13679              
13680             =item * C<fips10>
13681              
13682             A string field.
13683              
13684             =item * C<type>
13685              
13686             A string field.
13687              
13688             =back
13689              
13690             =head2 Table collations_l10n
13691              
13692             =over 4
13693              
13694             =item * C<collation_l10n_id>
13695              
13696             An integer field.
13697              
13698             =item * C<locale>
13699              
13700             A string field.
13701              
13702             =item * C<collation>
13703              
13704             A string field.
13705              
13706             =item * C<locale_name>
13707              
13708             A string field.
13709              
13710             =back
13711              
13712             =head2 Table currencies
13713              
13714             =over 4
13715              
13716             =item * C<currency_id>
13717              
13718             An integer field.
13719              
13720             =item * C<currency>
13721              
13722             A string field.
13723              
13724             =item * C<digits>
13725              
13726             An integer field.
13727              
13728             =item * C<rounding>
13729              
13730             An integer field.
13731              
13732             =item * C<cash_digits>
13733              
13734             An integer field.
13735              
13736             =item * C<cash_rounding>
13737              
13738             An integer field.
13739              
13740             =item * C<is_obsolete>
13741              
13742             A boolean field.
13743              
13744             =item * C<status>
13745              
13746             A string field.
13747              
13748             =back
13749              
13750             =head2 Table currencies_info
13751              
13752             =over 4
13753              
13754             =item * C<currency_info_id>
13755              
13756             An integer field.
13757              
13758             =item * C<territory>
13759              
13760             A string field.
13761              
13762             =item * C<currency>
13763              
13764             A string field.
13765              
13766             =item * C<start>
13767              
13768             A date field.
13769              
13770             =item * C<until>
13771              
13772             A date field.
13773              
13774             =item * C<is_tender>
13775              
13776             A boolean field.
13777              
13778             =item * C<hist_sequence>
13779              
13780             An integer field.
13781              
13782             =item * C<is_obsolete>
13783              
13784             A boolean field.
13785              
13786             =back
13787              
13788             =head2 Table currencies_l10n
13789              
13790             =over 4
13791              
13792             =item * C<curr_l10n_id>
13793              
13794             An integer field.
13795              
13796             =item * C<locale>
13797              
13798             A string field.
13799              
13800             =item * C<currency>
13801              
13802             A string field.
13803              
13804             =item * C<count>
13805              
13806             A string field.
13807              
13808             =item * C<locale_name>
13809              
13810             A string field.
13811              
13812             =item * C<symbol>
13813              
13814             A string field.
13815              
13816             =back
13817              
13818             =head2 Table date_fields_l10n
13819              
13820             =over 4
13821              
13822             =item * C<date_field_id>
13823              
13824             An integer field.
13825              
13826             =item * C<locale>
13827              
13828             A string field.
13829              
13830             =item * C<field_type>
13831              
13832             A string field.
13833              
13834             =item * C<field_length>
13835              
13836             A string field.
13837              
13838             =item * C<relative>
13839              
13840             An integer field.
13841              
13842             =item * C<locale_name>
13843              
13844             A string field.
13845              
13846             =back
13847              
13848             =head2 Table date_terms
13849              
13850             =over 4
13851              
13852             =item * C<date_term_id>
13853              
13854             An integer field.
13855              
13856             =item * C<locale>
13857              
13858             A string field.
13859              
13860             =item * C<term_type>
13861              
13862             A string field.
13863              
13864             =item * C<term_length>
13865              
13866             A string field.
13867              
13868             =item * C<display_name>
13869              
13870             A string field.
13871              
13872             =back
13873              
13874             =head2 Table day_periods
13875              
13876             =over 4
13877              
13878             =item * C<day_period_id>
13879              
13880             An integer field.
13881              
13882             =item * C<locale>
13883              
13884             A string field.
13885              
13886             =item * C<day_period>
13887              
13888             A string field.
13889              
13890             =item * C<start>
13891              
13892             A string field.
13893              
13894             =item * C<until>
13895              
13896             A string field.
13897              
13898             =back
13899              
13900             =head2 Table language_population
13901              
13902             =over 4
13903              
13904             =item * C<language_pop_id>
13905              
13906             An integer field.
13907              
13908             =item * C<territory>
13909              
13910             A string field.
13911              
13912             =item * C<locale>
13913              
13914             A string field.
13915              
13916             =item * C<population_percent>
13917              
13918             A decimal field.
13919              
13920             =item * C<literacy_percent>
13921              
13922             A decimal field.
13923              
13924             =item * C<writing_percent>
13925              
13926             A decimal field.
13927              
13928             =item * C<official_status>
13929              
13930             A string field.
13931              
13932             =back
13933              
13934             =head2 Table languages
13935              
13936             =over 4
13937              
13938             =item * C<language_id>
13939              
13940             An integer field.
13941              
13942             =item * C<language>
13943              
13944             A string field.
13945              
13946             =item * C<scripts>
13947              
13948             A string array field.
13949              
13950             =item * C<territories>
13951              
13952             A string array field.
13953              
13954             =item * C<parent>
13955              
13956             A string field.
13957              
13958             =item * C<alt>
13959              
13960             A string field.
13961              
13962             =item * C<status>
13963              
13964             A string field.
13965              
13966             =back
13967              
13968             =head2 Table languages_match
13969              
13970             =over 4
13971              
13972             =item * C<lang_match_id>
13973              
13974             An integer field.
13975              
13976             =item * C<desired>
13977              
13978             A string field.
13979              
13980             =item * C<supported>
13981              
13982             A string field.
13983              
13984             =item * C<distance>
13985              
13986             An integer field.
13987              
13988             =item * C<is_symetric>
13989              
13990             A boolean field.
13991              
13992             =item * C<is_regexp>
13993              
13994             A boolean field.
13995              
13996             =item * C<sequence>
13997              
13998             An integer field.
13999              
14000             =back
14001              
14002             =head2 Table likely_subtags
14003              
14004             =over 4
14005              
14006             =item * C<likely_subtag_id>
14007              
14008             An integer field.
14009              
14010             =item * C<locale>
14011              
14012             A string field.
14013              
14014             =item * C<target>
14015              
14016             A string field.
14017              
14018             =back
14019              
14020             =head2 Table locale_number_systems
14021              
14022             =over 4
14023              
14024             =item * C<locale_num_sys_id>
14025              
14026             An integer field.
14027              
14028             =item * C<locale>
14029              
14030             A string field.
14031              
14032             =item * C<number_system>
14033              
14034             A string field.
14035              
14036             =item * C<native>
14037              
14038             A string field.
14039              
14040             =item * C<traditional>
14041              
14042             A string field.
14043              
14044             =item * C<finance>
14045              
14046             A string field.
14047              
14048             =back
14049              
14050             =head2 Table locales
14051              
14052             =over 4
14053              
14054             =item * C<locale_id>
14055              
14056             An integer field.
14057              
14058             =item * C<locale>
14059              
14060             A string field.
14061              
14062             =item * C<parent>
14063              
14064             A string field.
14065              
14066             =item * C<collations>
14067              
14068             A string array field.
14069              
14070             =item * C<status>
14071              
14072             A string field.
14073              
14074             =back
14075              
14076             =head2 Table locales_info
14077              
14078             =over 4
14079              
14080             =item * C<locales_info_id>
14081              
14082             An integer field.
14083              
14084             =item * C<locale>
14085              
14086             A string field.
14087              
14088             =item * C<property>
14089              
14090             A string field.
14091              
14092             =item * C<value>
14093              
14094             A string field.
14095              
14096             =back
14097              
14098             =head2 Table locales_l10n
14099              
14100             =over 4
14101              
14102             =item * C<locales_l10n_id>
14103              
14104             An integer field.
14105              
14106             =item * C<locale>
14107              
14108             A string field.
14109              
14110             =item * C<locale_id>
14111              
14112             A string field.
14113              
14114             =item * C<locale_name>
14115              
14116             A string field.
14117              
14118             =item * C<alt>
14119              
14120             A string field.
14121              
14122             =back
14123              
14124             =head2 Table metainfos
14125              
14126             =over 4
14127              
14128             =item * C<meta_id>
14129              
14130             An integer field.
14131              
14132             =item * C<property>
14133              
14134             A string field.
14135              
14136             =item * C<value>
14137              
14138             A string field.
14139              
14140             =back
14141              
14142             =head2 Table metazones
14143              
14144             =over 4
14145              
14146             =item * C<metazone_id>
14147              
14148             An integer field.
14149              
14150             =item * C<metazone>
14151              
14152             A string field.
14153              
14154             =item * C<territories>
14155              
14156             A string array field.
14157              
14158             =item * C<timezones>
14159              
14160             A string array field.
14161              
14162             =back
14163              
14164             =head2 Table metazones_names
14165              
14166             =over 4
14167              
14168             =item * C<metatz_name_id>
14169              
14170             An integer field.
14171              
14172             =item * C<locale>
14173              
14174             A string field.
14175              
14176             =item * C<metazone>
14177              
14178             A string field.
14179              
14180             =item * C<width>
14181              
14182             A string field.
14183              
14184             =item * C<generic>
14185              
14186             A string field.
14187              
14188             =item * C<standard>
14189              
14190             A string field.
14191              
14192             =item * C<daylight>
14193              
14194             A string field.
14195              
14196             =back
14197              
14198             =head2 Table number_formats_l10n
14199              
14200             =over 4
14201              
14202             =item * C<number_format_id>
14203              
14204             An integer field.
14205              
14206             =item * C<locale>
14207              
14208             A string field.
14209              
14210             =item * C<number_system>
14211              
14212             A string field.
14213              
14214             =item * C<number_type>
14215              
14216             A string field.
14217              
14218             =item * C<format_length>
14219              
14220             A string field.
14221              
14222             =item * C<format_type>
14223              
14224             A string field.
14225              
14226             =item * C<format_id>
14227              
14228             A string field.
14229              
14230             =item * C<format_pattern>
14231              
14232             A string field.
14233              
14234             =item * C<alt>
14235              
14236             A string field.
14237              
14238             =item * C<count>
14239              
14240             A string field.
14241              
14242             =back
14243              
14244             =head2 Table number_symbols_l10n
14245              
14246             =over 4
14247              
14248             =item * C<number_symbol_id>
14249              
14250             An integer field.
14251              
14252             =item * C<locale>
14253              
14254             A string field.
14255              
14256             =item * C<number_system>
14257              
14258             A string field.
14259              
14260             =item * C<property>
14261              
14262             A string field.
14263              
14264             =item * C<value>
14265              
14266             A string field.
14267              
14268             =item * C<alt>
14269              
14270             A string field.
14271              
14272             =back
14273              
14274             =head2 Table number_systems
14275              
14276             =over 4
14277              
14278             =item * C<numsys_id>
14279              
14280             An integer field.
14281              
14282             =item * C<number_system>
14283              
14284             A string field.
14285              
14286             =item * C<digits>
14287              
14288             A string array field.
14289              
14290             =item * C<type>
14291              
14292             A string field.
14293              
14294             =back
14295              
14296             =head2 Table number_systems_l10n
14297              
14298             =over 4
14299              
14300             =item * C<num_sys_l10n_id>
14301              
14302             An integer field.
14303              
14304             =item * C<locale>
14305              
14306             A string field.
14307              
14308             =item * C<number_system>
14309              
14310             A string field.
14311              
14312             =item * C<locale_name>
14313              
14314             A string field.
14315              
14316             =item * C<alt>
14317              
14318             A string field.
14319              
14320             =back
14321              
14322             =head2 Table person_name_defaults
14323              
14324             =over 4
14325              
14326             =item * C<pers_name_def_id>
14327              
14328             An integer field.
14329              
14330             =item * C<locale>
14331              
14332             A string field.
14333              
14334             =item * C<value>
14335              
14336             A string field.
14337              
14338             =back
14339              
14340             =head2 Table rbnf
14341              
14342             =over 4
14343              
14344             =item * C<rbnf_id>
14345              
14346             An integer field.
14347              
14348             =item * C<locale>
14349              
14350             A string field.
14351              
14352             =item * C<grouping>
14353              
14354             A string field.
14355              
14356             =item * C<ruleset>
14357              
14358             A string field.
14359              
14360             =item * C<rule_id>
14361              
14362             A string field.
14363              
14364             =item * C<rule_value>
14365              
14366             A string field.
14367              
14368             =back
14369              
14370             =head2 Table refs
14371              
14372             =over 4
14373              
14374             =item * C<ref_id>
14375              
14376             An integer field.
14377              
14378             =item * C<code>
14379              
14380             A string field.
14381              
14382             =item * C<uri>
14383              
14384             A string field.
14385              
14386             =item * C<description>
14387              
14388             A string field.
14389              
14390             =back
14391              
14392             =head2 Table scripts
14393              
14394             =over 4
14395              
14396             =item * C<script_id>
14397              
14398             An integer field.
14399              
14400             =item * C<script>
14401              
14402             A string field.
14403              
14404             =item * C<rank>
14405              
14406             An integer field.
14407              
14408             =item * C<sample_char>
14409              
14410             A string field.
14411              
14412             =item * C<id_usage>
14413              
14414             A string field.
14415              
14416             =item * C<rtl>
14417              
14418             A boolean field.
14419              
14420             =item * C<lb_letters>
14421              
14422             A boolean field.
14423              
14424             =item * C<has_case>
14425              
14426             A boolean field.
14427              
14428             =item * C<shaping_req>
14429              
14430             A boolean field.
14431              
14432             =item * C<ime>
14433              
14434             A boolean field.
14435              
14436             =item * C<density>
14437              
14438             An integer field.
14439              
14440             =item * C<origin_country>
14441              
14442             A string field.
14443              
14444             =item * C<likely_language>
14445              
14446             A string field.
14447              
14448             =item * C<status>
14449              
14450             A string field.
14451              
14452             =back
14453              
14454             =head2 Table scripts_l10n
14455              
14456             =over 4
14457              
14458             =item * C<scripts_l10n_id>
14459              
14460             An integer field.
14461              
14462             =item * C<locale>
14463              
14464             A string field.
14465              
14466             =item * C<script>
14467              
14468             A string field.
14469              
14470             =item * C<locale_name>
14471              
14472             A string field.
14473              
14474             =item * C<alt>
14475              
14476             A string field.
14477              
14478             =back
14479              
14480             =head2 Table subdivisions
14481              
14482             =over 4
14483              
14484             =item * C<subdivision_id>
14485              
14486             An integer field.
14487              
14488             =item * C<territory>
14489              
14490             A string field.
14491              
14492             =item * C<subdivision>
14493              
14494             A string field.
14495              
14496             =item * C<parent>
14497              
14498             A string field.
14499              
14500             =item * C<is_top_level>
14501              
14502             A boolean field.
14503              
14504             =item * C<status>
14505              
14506             A string field.
14507              
14508             =back
14509              
14510             =head2 Table subdivisions_l10n
14511              
14512             =over 4
14513              
14514             =item * C<subdiv_l10n_id>
14515              
14516             An integer field.
14517              
14518             =item * C<locale>
14519              
14520             A string field.
14521              
14522             =item * C<subdivision>
14523              
14524             A string field.
14525              
14526             =item * C<locale_name>
14527              
14528             A string field.
14529              
14530             =back
14531              
14532             =head2 Table territories
14533              
14534             =over 4
14535              
14536             =item * C<territory_id>
14537              
14538             An integer field.
14539              
14540             =item * C<territory>
14541              
14542             A string field.
14543              
14544             =item * C<parent>
14545              
14546             A string field.
14547              
14548             =item * C<gdp>
14549              
14550             An integer field.
14551              
14552             =item * C<literacy_percent>
14553              
14554             A decimal field.
14555              
14556             =item * C<population>
14557              
14558             An integer field.
14559              
14560             =item * C<languages>
14561              
14562             A string array field.
14563              
14564             =item * C<contains>
14565              
14566             A string array field.
14567              
14568             =item * C<currency>
14569              
14570             A string field.
14571              
14572             =item * C<calendars>
14573              
14574             A string array field.
14575              
14576             =item * C<min_days>
14577              
14578             An integer field.
14579              
14580             =item * C<first_day>
14581              
14582             An integer field.
14583              
14584             =item * C<weekend>
14585              
14586             An integer array field.
14587              
14588             =item * C<status>
14589              
14590             A string field.
14591              
14592             =back
14593              
14594             =head2 Table territories_l10n
14595              
14596             =over 4
14597              
14598             =item * C<terr_l10n_id>
14599              
14600             An integer field.
14601              
14602             =item * C<locale>
14603              
14604             A string field.
14605              
14606             =item * C<territory>
14607              
14608             A string field.
14609              
14610             =item * C<locale_name>
14611              
14612             A string field.
14613              
14614             =item * C<alt>
14615              
14616             A string field.
14617              
14618             =back
14619              
14620             =head2 Table time_formats
14621              
14622             =over 4
14623              
14624             =item * C<time_format_id>
14625              
14626             An integer field.
14627              
14628             =item * C<region>
14629              
14630             A string field.
14631              
14632             =item * C<territory>
14633              
14634             A string field.
14635              
14636             =item * C<locale>
14637              
14638             A string field.
14639              
14640             =item * C<time_format>
14641              
14642             A string field.
14643              
14644             =item * C<time_allowed>
14645              
14646             A string array field.
14647              
14648             =back
14649              
14650             =head2 Table time_relative_l10n
14651              
14652             =over 4
14653              
14654             =item * C<time_relative_id>
14655              
14656             An integer field.
14657              
14658             =item * C<locale>
14659              
14660             A string field.
14661              
14662             =item * C<field_type>
14663              
14664             A string field.
14665              
14666             =item * C<field_length>
14667              
14668             A string field.
14669              
14670             =item * C<relative>
14671              
14672             An integer field.
14673              
14674             =item * C<format_pattern>
14675              
14676             A string field.
14677              
14678             =item * C<count>
14679              
14680             A string field.
14681              
14682             =back
14683              
14684             =head2 Table timezones
14685              
14686             =over 4
14687              
14688             =item * C<timezone_id>
14689              
14690             An integer field.
14691              
14692             =item * C<timezone>
14693              
14694             A string field.
14695              
14696             =item * C<territory>
14697              
14698             A string field.
14699              
14700             =item * C<region>
14701              
14702             A string field.
14703              
14704             =item * C<tzid>
14705              
14706             A string field.
14707              
14708             =item * C<metazone>
14709              
14710             A string field.
14711              
14712             =item * C<tz_bcpid>
14713              
14714             A string field.
14715              
14716             =item * C<is_golden>
14717              
14718             A boolean field.
14719              
14720             =item * C<is_primary>
14721              
14722             A boolean field.
14723              
14724             =item * C<is_preferred>
14725              
14726             A boolean field.
14727              
14728             =item * C<is_canonical>
14729              
14730             A boolean field.
14731              
14732             =item * C<alias>
14733              
14734             A string array field.
14735              
14736             =back
14737              
14738             =head2 Table timezones_cities
14739              
14740             =over 4
14741              
14742             =item * C<tz_city_id>
14743              
14744             An integer field.
14745              
14746             =item * C<locale>
14747              
14748             A string field.
14749              
14750             =item * C<timezone>
14751              
14752             A string field.
14753              
14754             =item * C<city>
14755              
14756             A string field.
14757              
14758             =item * C<alt>
14759              
14760             A string field.
14761              
14762             =back
14763              
14764             =head2 Table timezones_cities_supplemental
14765              
14766             =over 4
14767              
14768             =item * C<tz_city_id>
14769              
14770             An integer field.
14771              
14772             =item * C<locale>
14773              
14774             A string field.
14775              
14776             =item * C<timezone>
14777              
14778             A string field.
14779              
14780             =item * C<city>
14781              
14782             A string field.
14783              
14784             =item * C<alt>
14785              
14786             A string field.
14787              
14788             =back
14789              
14790             =head2 Table timezones_formats
14791              
14792             =over 4
14793              
14794             =item * C<tz_fmt_id>
14795              
14796             An integer field.
14797              
14798             =item * C<locale>
14799              
14800             A string field.
14801              
14802             =item * C<type>
14803              
14804             A string field.
14805              
14806             =item * C<subtype>
14807              
14808             A string field.
14809              
14810             =item * C<format_pattern>
14811              
14812             A string field.
14813              
14814             =back
14815              
14816             =head2 Table timezones_info
14817              
14818             =over 4
14819              
14820             =item * C<tzinfo_id>
14821              
14822             An integer field.
14823              
14824             =item * C<timezone>
14825              
14826             A string field.
14827              
14828             =item * C<metazone>
14829              
14830             A string field.
14831              
14832             =item * C<start>
14833              
14834             A datetime field.
14835              
14836             =item * C<until>
14837              
14838             A datetime field.
14839              
14840             =back
14841              
14842             =head2 Table timezones_names
14843              
14844             =over 4
14845              
14846             =item * C<tz_name_id>
14847              
14848             An integer field.
14849              
14850             =item * C<locale>
14851              
14852             A string field.
14853              
14854             =item * C<timezone>
14855              
14856             A string field.
14857              
14858             =item * C<width>
14859              
14860             A string field.
14861              
14862             =item * C<generic>
14863              
14864             A string field.
14865              
14866             =item * C<standard>
14867              
14868             A string field.
14869              
14870             =item * C<daylight>
14871              
14872             A string field.
14873              
14874             =back
14875              
14876             =head2 Table unit_aliases
14877              
14878             =over 4
14879              
14880             =item * C<unit_alias_id>
14881              
14882             An integer field.
14883              
14884             =item * C<alias>
14885              
14886             A string field.
14887              
14888             =item * C<target>
14889              
14890             A string field.
14891              
14892             =item * C<reason>
14893              
14894             A string field.
14895              
14896             =back
14897              
14898             =head2 Table unit_constants
14899              
14900             =over 4
14901              
14902             =item * C<unit_constant_id>
14903              
14904             An integer field.
14905              
14906             =item * C<constant>
14907              
14908             A string field.
14909              
14910             =item * C<expression>
14911              
14912             A string field.
14913              
14914             =item * C<value>
14915              
14916             A decimal field.
14917              
14918             =item * C<description>
14919              
14920             A string field.
14921              
14922             =item * C<status>
14923              
14924             A string field.
14925              
14926             =back
14927              
14928             =head2 Table unit_conversions
14929              
14930             =over 4
14931              
14932             =item * C<unit_conversion_id>
14933              
14934             An integer field.
14935              
14936             =item * C<source>
14937              
14938             A string field.
14939              
14940             =item * C<base_unit>
14941              
14942             A string field.
14943              
14944             =item * C<expression>
14945              
14946             A string field.
14947              
14948             =item * C<factor>
14949              
14950             A decimal field.
14951              
14952             =item * C<systems>
14953              
14954             A string array field.
14955              
14956             =item * C<category>
14957              
14958             A string field.
14959              
14960             =back
14961              
14962             =head2 Table unit_prefixes
14963              
14964             =over 4
14965              
14966             =item * C<unit_prefix_id>
14967              
14968             An integer field.
14969              
14970             =item * C<unit_id>
14971              
14972             A string field.
14973              
14974             =item * C<symbol>
14975              
14976             A string field.
14977              
14978             =item * C<power>
14979              
14980             An integer field.
14981              
14982             =item * C<factor>
14983              
14984             An integer field.
14985              
14986             =back
14987              
14988             =head2 Table unit_prefs
14989              
14990             =over 4
14991              
14992             =item * C<unit_pref_id>
14993              
14994             An integer field.
14995              
14996             =item * C<unit_id>
14997              
14998             A string field.
14999              
15000             =item * C<territory>
15001              
15002             A string field.
15003              
15004             =item * C<category>
15005              
15006             A string field.
15007              
15008             =item * C<usage>
15009              
15010             A string field.
15011              
15012             =item * C<geq>
15013              
15014             A decimal field.
15015              
15016             =item * C<skeleton>
15017              
15018             A string field.
15019              
15020             =back
15021              
15022             =head2 Table unit_quantities
15023              
15024             =over 4
15025              
15026             =item * C<unit_quantity_id>
15027              
15028             An integer field.
15029              
15030             =item * C<base_unit>
15031              
15032             A string field.
15033              
15034             =item * C<quantity>
15035              
15036             A string field.
15037              
15038             =item * C<status>
15039              
15040             A string field.
15041              
15042             =item * C<comment>
15043              
15044             A string field.
15045              
15046             =back
15047              
15048             =head2 Table units_l10n
15049              
15050             =over 4
15051              
15052             =item * C<units_l10n_id>
15053              
15054             An integer field.
15055              
15056             =item * C<locale>
15057              
15058             A string field.
15059              
15060             =item * C<format_length>
15061              
15062             A string field.
15063              
15064             =item * C<unit_type>
15065              
15066             A string field.
15067              
15068             =item * C<unit_id>
15069              
15070             A string field.
15071              
15072             =item * C<unit_pattern>
15073              
15074             A string field.
15075              
15076             =item * C<pattern_type>
15077              
15078             A string field.
15079              
15080             =item * C<locale_name>
15081              
15082             A string field.
15083              
15084             =item * C<count>
15085              
15086             A string field.
15087              
15088             =item * C<gender>
15089              
15090             A string field.
15091              
15092             =item * C<gram_case>
15093              
15094             A string field.
15095              
15096             =back
15097              
15098             =head2 Table variants
15099              
15100             =over 4
15101              
15102             =item * C<variant_id>
15103              
15104             An integer field.
15105              
15106             =item * C<variant>
15107              
15108             A string field.
15109              
15110             =item * C<status>
15111              
15112             A string field.
15113              
15114             =back
15115              
15116             =head2 Table variants_l10n
15117              
15118             =over 4
15119              
15120             =item * C<var_l10n_id>
15121              
15122             An integer field.
15123              
15124             =item * C<locale>
15125              
15126             A string field.
15127              
15128             =item * C<variant>
15129              
15130             A string field.
15131              
15132             =item * C<locale_name>
15133              
15134             A string field.
15135              
15136             =item * C<alt>
15137              
15138             A string field.
15139              
15140             =back
15141              
15142             =head2 Table week_preferences
15143              
15144             =over 4
15145              
15146             =item * C<week_pref_id>
15147              
15148             An integer field.
15149              
15150             =item * C<locale>
15151              
15152             A string field.
15153              
15154             =item * C<ordering>
15155              
15156             A string array field.
15157              
15158             =back
15159              
15160             =head1 AUTHOR
15161              
15162             Jacques Deguest E<lt>F<jack@deguest.jp>E<gt>
15163              
15164             =head1 SEE ALSO
15165              
15166             L<Locale::Unicode>, L<DateTime::Locale::FromCLDR>, L<DateTime::Formatter::Unicode>, L<DateTime::Locale::FromData>, L<DateTime::Format::CLDR>
15167              
15168             =head1 CREDITS
15169              
15170             Credits to GeoNames (L<http://www.geonames.org|http://www.geonames.org>) and its data that helped build the time zones extended exemplar cities data in many localised versions.
15171              
15172             GeoNames is a project of Unxos GmbH, Tutilostrasse 17d, 9011 St. Gallen, Switzerland, and managed by Marc Wick.
15173              
15174             GeoNames data is licensed under a Creative Commons Attribution 4.0 License.
15175              
15176             =head1 COPYRIGHT & LICENSE
15177              
15178             Copyright(c) 2024 DEGUEST Pte. Ltd.
15179              
15180             All rights reserved
15181              
15182             This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
15183              
15184             =cut