| File | /usr/local/lib/perl5/site_perl/5.10.1/DateTime/Locale/Base.pm |
| Statements Executed | 721 |
| Statement Execution Time | 4.82ms |
| Calls | P | F | Exclusive Time |
Inclusive Time |
Subroutine |
|---|---|---|---|---|---|
| 14 | 1 | 1 | 779µs | 1.00ms | DateTime::Locale::Base::_convert |
| 17 | 1 | 1 | 454µs | 1.30ms | DateTime::Locale::Base::STORABLE_thaw |
| 1 | 1 | 1 | 417µs | 550µs | DateTime::Locale::Base::BEGIN@6 |
| 178 | 1 | 2 | 171µs | 171µs | DateTime::Locale::Base::CORE:regcomp (opcode) |
| 3 | 1 | 1 | 104µs | 1.16ms | DateTime::Locale::Base::_cldr_to_strftime |
| 5 | 1 | 1 | 96µs | 144µs | DateTime::Locale::Base::_make_datetime_format |
| 13 | 1 | 1 | 93µs | 139µs | DateTime::Locale::Base::STORABLE_freeze |
| 15 | 3 | 1 | 84µs | 1.25ms | DateTime::Locale::Base::_convert_to_strftime |
| 1 | 1 | 1 | 81µs | 91µs | DateTime::Locale::Base::BEGIN@12 |
| 5 | 1 | 1 | 71µs | 228µs | DateTime::Locale::Base::datetime_format_default |
| 2 | 1 | 1 | 59µs | 66µs | DateTime::Locale::Base::new |
| 5 | 1 | 1 | 55µs | 75µs | DateTime::Locale::Base::date_format_default |
| 5 | 1 | 1 | 54µs | 74µs | DateTime::Locale::Base::time_format_default |
| 10 | 2 | 1 | 52µs | 70µs | DateTime::Locale::Base::am_pms |
| 178 | 1 | 2 | 50µs | 50µs | DateTime::Locale::Base::CORE:match (opcode) |
| 5 | 1 | 1 | 48µs | 344µs | DateTime::Locale::Base::default_date_format |
| 17 | 1 | 2 | 47µs | 47µs | DateTime::Locale::Base::CORE:substcont (opcode) |
| 35 | 5 | 2 | 47µs | 47µs | DateTime::Locale::Base::CORE:subst (opcode) |
| 13 | 1 | 1 | 46µs | 46µs | DateTime::Locale::Base::__ANON__[:26] |
| 5 | 1 | 1 | 42µs | 595µs | DateTime::Locale::Base::default_time_format |
| 5 | 1 | 1 | 40µs | 814µs | DateTime::Locale::Base::default_datetime_format |
| 5 | 1 | 1 | 27µs | 36µs | DateTime::Locale::Base::day_names |
| 5 | 1 | 1 | 26µs | 34µs | DateTime::Locale::Base::month_names |
| 5 | 1 | 1 | 24µs | 32µs | DateTime::Locale::Base::day_abbreviations |
| 5 | 1 | 1 | 24µs | 33µs | DateTime::Locale::Base::month_abbreviations |
| 29 | 1 | 2 | 24µs | 24µs | DateTime::Locale::Base::CORE:qr (opcode) |
| 10 | 2 | 1 | 19µs | 19µs | DateTime::Locale::Base::default_date_format_length |
| 10 | 2 | 1 | 18µs | 18µs | DateTime::Locale::Base::default_time_format_length |
| 1 | 1 | 1 | 14µs | 16µs | DateTime::Locale::Base::BEGIN@3 |
| 1 | 1 | 1 | 8µs | 8µs | DateTime::Locale::Base::BEGIN@7 |
| 1 | 1 | 1 | 8µs | 16µs | DateTime::Locale::Base::BEGIN@4 |
| 1 | 1 | 1 | 8µs | 19µs | DateTime::Locale::Base::BEGIN@138 |
| 1 | 1 | 1 | 7µs | 18µs | DateTime::Locale::Base::BEGIN@25 |
| 1 | 1 | 1 | 7µs | 37µs | DateTime::Locale::Base::BEGIN@9 |
| 1 | 1 | 1 | 4µs | 4µs | DateTime::Locale::Base::BEGIN@8 |
| 0 | 0 | 0 | 0s | 0s | DateTime::Locale::Base::__ANON__[:136] |
| 0 | 0 | 0 | 0s | 0s | DateTime::Locale::Base::_available_formats |
| 0 | 0 | 0 | 0s | 0s | DateTime::Locale::Base::_stringify |
| 0 | 0 | 0 | 0s | 0s | DateTime::Locale::Base::am_pm |
| 0 | 0 | 0 | 0s | 0s | DateTime::Locale::Base::available_formats |
| 0 | 0 | 0 | 0s | 0s | DateTime::Locale::Base::date_before_time |
| 0 | 0 | 0 | 0s | 0s | DateTime::Locale::Base::date_formats |
| 0 | 0 | 0 | 0s | 0s | DateTime::Locale::Base::date_parts_order |
| 0 | 0 | 0 | 0s | 0s | DateTime::Locale::Base::day_abbreviation |
| 0 | 0 | 0 | 0s | 0s | DateTime::Locale::Base::day_name |
| 0 | 0 | 0 | 0s | 0s | DateTime::Locale::Base::day_narrow |
| 0 | 0 | 0 | 0s | 0s | DateTime::Locale::Base::day_narrows |
| 0 | 0 | 0 | 0s | 0s | DateTime::Locale::Base::era |
| 0 | 0 | 0 | 0s | 0s | DateTime::Locale::Base::era_abbreviation |
| 0 | 0 | 0 | 0s | 0s | DateTime::Locale::Base::era_abbreviations |
| 0 | 0 | 0 | 0s | 0s | DateTime::Locale::Base::era_name |
| 0 | 0 | 0 | 0s | 0s | DateTime::Locale::Base::era_names |
| 0 | 0 | 0 | 0s | 0s | DateTime::Locale::Base::era_narrow |
| 0 | 0 | 0 | 0s | 0s | DateTime::Locale::Base::eras |
| 0 | 0 | 0 | 0s | 0s | DateTime::Locale::Base::format_for |
| 0 | 0 | 0 | 0s | 0s | DateTime::Locale::Base::full_date_format |
| 0 | 0 | 0 | 0s | 0s | DateTime::Locale::Base::full_datetime_format |
| 0 | 0 | 0 | 0s | 0s | DateTime::Locale::Base::full_time_format |
| 0 | 0 | 0 | 0s | 0s | DateTime::Locale::Base::language_id |
| 0 | 0 | 0 | 0s | 0s | DateTime::Locale::Base::long_date_format |
| 0 | 0 | 0 | 0s | 0s | DateTime::Locale::Base::long_datetime_format |
| 0 | 0 | 0 | 0s | 0s | DateTime::Locale::Base::long_time_format |
| 0 | 0 | 0 | 0s | 0s | DateTime::Locale::Base::medium_date_format |
| 0 | 0 | 0 | 0s | 0s | DateTime::Locale::Base::medium_datetime_format |
| 0 | 0 | 0 | 0s | 0s | DateTime::Locale::Base::medium_time_format |
| 0 | 0 | 0 | 0s | 0s | DateTime::Locale::Base::month_abbreviation |
| 0 | 0 | 0 | 0s | 0s | DateTime::Locale::Base::month_name |
| 0 | 0 | 0 | 0s | 0s | DateTime::Locale::Base::month_narrow |
| 0 | 0 | 0 | 0s | 0s | DateTime::Locale::Base::month_narrows |
| 0 | 0 | 0 | 0s | 0s | DateTime::Locale::Base::prefers_24_hour_time |
| 0 | 0 | 0 | 0s | 0s | DateTime::Locale::Base::quarter_abbreviation |
| 0 | 0 | 0 | 0s | 0s | DateTime::Locale::Base::quarter_abbreviations |
| 0 | 0 | 0 | 0s | 0s | DateTime::Locale::Base::quarter_name |
| 0 | 0 | 0 | 0s | 0s | DateTime::Locale::Base::quarter_names |
| 0 | 0 | 0 | 0s | 0s | DateTime::Locale::Base::quarter_narrow |
| 0 | 0 | 0 | 0s | 0s | DateTime::Locale::Base::script_id |
| 0 | 0 | 0 | 0s | 0s | DateTime::Locale::Base::set_default_date_format_length |
| 0 | 0 | 0 | 0s | 0s | DateTime::Locale::Base::set_default_time_format_length |
| 0 | 0 | 0 | 0s | 0s | DateTime::Locale::Base::short_date_format |
| 0 | 0 | 0 | 0s | 0s | DateTime::Locale::Base::short_datetime_format |
| 0 | 0 | 0 | 0s | 0s | DateTime::Locale::Base::short_time_format |
| 0 | 0 | 0 | 0s | 0s | DateTime::Locale::Base::territory_id |
| 0 | 0 | 0 | 0s | 0s | DateTime::Locale::Base::time_formats |
| 0 | 0 | 0 | 0s | 0s | DateTime::Locale::Base::variant_id |
| Line | State ments |
Time on line |
Calls | Time in subs |
Code |
|---|---|---|---|---|---|
| 1 | package DateTime::Locale::Base; | ||||
| 2 | |||||
| 3 | 3 | 21µs | 2 | 19µs | # spent 16µs (14+3) within DateTime::Locale::Base::BEGIN@3 which was called
# once (14µs+3µs) by DateTime::Locale::BEGIN@10 at line 3 # spent 16µs making 1 call to DateTime::Locale::Base::BEGIN@3
# spent 3µs making 1 call to strict::import |
| 4 | 3 | 20µs | 2 | 25µs | # spent 16µs (8+8) within DateTime::Locale::Base::BEGIN@4 which was called
# once (8µs+8µs) by DateTime::Locale::BEGIN@10 at line 4 # spent 16µs making 1 call to DateTime::Locale::Base::BEGIN@4
# spent 8µs making 1 call to warnings::import |
| 5 | |||||
| 6 | 3 | 101µs | 1 | 550µs | # spent 550µs (417+133) within DateTime::Locale::Base::BEGIN@6 which was called
# once (417µs+133µs) by DateTime::Locale::BEGIN@10 at line 6 # spent 550µs making 1 call to DateTime::Locale::Base::BEGIN@6 |
| 7 | 3 | 23µs | 1 | 8µs | # spent 8µs within DateTime::Locale::Base::BEGIN@7 which was called
# once (8µs+0s) by DateTime::Locale::BEGIN@10 at line 7 # spent 8µs making 1 call to DateTime::Locale::Base::BEGIN@7 |
| 8 | 3 | 21µs | 1 | 4µs | # spent 4µs within DateTime::Locale::Base::BEGIN@8 which was called
# once (4µs+0s) by DateTime::Locale::BEGIN@10 at line 8 # spent 4µs making 1 call to DateTime::Locale::Base::BEGIN@8 |
| 9 | 3 | 67µs | 2 | 66µs | # spent 37µs (7+30) within DateTime::Locale::Base::BEGIN@9 which was called
# once (7µs+30µs) by DateTime::Locale::BEGIN@10 at line 9 # spent 37µs making 1 call to DateTime::Locale::Base::BEGIN@9
# spent 30µs making 1 call to Exporter::import |
| 10 | |||||
| 11 | BEGIN | ||||
| 12 | # spent 91µs (81+10) within DateTime::Locale::Base::BEGIN@12 which was called
# once (81µs+10µs) by DateTime::Locale::BEGIN@10 at line 28 | ||||
| 13 | 34 | 86µs | foreach my $field ( qw( id en_complete_name native_complete_name | ||
| 14 | en_language en_script en_territory en_variant | ||||
| 15 | native_language native_script native_territory native_variant | ||||
| 16 | ) | ||||
| 17 | ) | ||||
| 18 | { | ||||
| 19 | # remove leading 'en_' for method name | ||||
| 20 | (my $meth_name = $field) =~ s/^en_//; # spent 6µs making 11 calls to DateTime::Locale::Base::CORE:subst, avg 527ns/call | ||||
| 21 | |||||
| 22 | # also remove 'complete_' | ||||
| 23 | $meth_name =~ s/complete_//; # spent 4µs making 11 calls to DateTime::Locale::Base::CORE:subst, avg 364ns/call | ||||
| 24 | |||||
| 25 | 3 | 53µs | 2 | 29µs | # spent 18µs (7+11) within DateTime::Locale::Base::BEGIN@25 which was called
# once (7µs+11µs) by DateTime::Locale::BEGIN@10 at line 25 # spent 18µs making 1 call to DateTime::Locale::Base::BEGIN@25
# spent 11µs making 1 call to strict::unimport |
| 26 | 13 | 55µs | # spent 46µs within DateTime::Locale::Base::__ANON__[/usr/local/lib/perl5/site_perl/5.10.1/DateTime/Locale/Base.pm:26] which was called 13 times, avg 4µs/call:
# 13 times (46µs+0s) by DateTime::Locale::Base::STORABLE_freeze at line 350, avg 4µs/call | ||
| 27 | } | ||||
| 28 | 1 | 524µs | 1 | 91µs | } # spent 91µs making 1 call to DateTime::Locale::Base::BEGIN@12 |
| 29 | |||||
| 30 | sub new | ||||
| 31 | # spent 66µs (59+7) within DateTime::Locale::Base::new which was called 2 times, avg 33µs/call:
# 2 times (59µs+7µs) by DateTime::Locale::_load_class_from_id at line 305 of DateTime/Locale.pm, avg 33µs/call | ||||
| 32 | 4 | 51µs | my $class = shift; | ||
| 33 | |||||
| 34 | # By making the default format lengths part of the object's hash | ||||
| 35 | # key, it allows them to be settable. | ||||
| 36 | return bless { @_, # spent 4µs making 2 calls to DateTime::Locale::root::_default_date_format_length, avg 2µs/call
# spent 3µs making 2 calls to DateTime::Locale::root::_default_time_format_length, avg 1µs/call | ||||
| 37 | default_date_format_length => $class->_default_date_format_length(), | ||||
| 38 | default_time_format_length => $class->_default_time_format_length(), | ||||
| 39 | }, $class; | ||||
| 40 | } | ||||
| 41 | |||||
| 42 | sub language_id { ( DateTime::Locale::_parse_id( $_[0]->id ) )[0] } | ||||
| 43 | sub script_id { ( DateTime::Locale::_parse_id( $_[0]->id ) )[1] } | ||||
| 44 | sub territory_id { ( DateTime::Locale::_parse_id( $_[0]->id ) )[2] } | ||||
| 45 | sub variant_id { ( DateTime::Locale::_parse_id( $_[0]->id ) )[3] } | ||||
| 46 | |||||
| 47 | 1 | 2µs | my @FormatLengths = qw( short medium long full ); | ||
| 48 | |||||
| 49 | sub date_format_default | ||||
| 50 | # spent 75µs (55+21) within DateTime::Locale::Base::date_format_default which was called 5 times, avg 15µs/call:
# 5 times (55µs+21µs) by DateTime::Locale::Base::default_date_format at line 243, avg 15µs/call | ||||
| 51 | 10 | 45µs | 5 | 12µs | my $meth = 'date_format_' . $_[0]->default_date_format_length(); # spent 12µs making 5 calls to DateTime::Locale::Base::default_date_format_length, avg 2µs/call |
| 52 | $_[0]->$meth(); # spent 9µs making 5 calls to DateTime::Locale::en::date_format_medium, avg 2µs/call | ||||
| 53 | } | ||||
| 54 | |||||
| 55 | sub date_formats | ||||
| 56 | { | ||||
| 57 | return | ||||
| 58 | { map { my $meth = 'date_format_' . $_; | ||||
| 59 | $_ => $_[0]->$meth() } @FormatLengths } | ||||
| 60 | } | ||||
| 61 | |||||
| 62 | sub time_format_default | ||||
| 63 | # spent 74µs (54+21) within DateTime::Locale::Base::time_format_default which was called 5 times, avg 15µs/call:
# 5 times (54µs+21µs) by DateTime::Locale::Base::default_time_format at line 249, avg 15µs/call | ||||
| 64 | 10 | 44µs | 5 | 11µs | my $meth = 'time_format_' . $_[0]->default_time_format_length(); # spent 11µs making 5 calls to DateTime::Locale::Base::default_time_format_length, avg 2µs/call |
| 65 | $_[0]->$meth(); # spent 9µs making 5 calls to DateTime::Locale::en::time_format_medium, avg 2µs/call | ||||
| 66 | } | ||||
| 67 | |||||
| 68 | sub time_formats | ||||
| 69 | { | ||||
| 70 | return | ||||
| 71 | { map { my $meth = 'time_format_' . $_; | ||||
| 72 | $_ => $_[0]->$meth() } @FormatLengths } | ||||
| 73 | } | ||||
| 74 | |||||
| 75 | sub format_for | ||||
| 76 | { | ||||
| 77 | my $self = shift; | ||||
| 78 | my $for = shift; | ||||
| 79 | |||||
| 80 | my $meth = '_format_for_' . $for; | ||||
| 81 | |||||
| 82 | return unless $self->can($meth); | ||||
| 83 | |||||
| 84 | return $self->$meth(); | ||||
| 85 | } | ||||
| 86 | |||||
| 87 | sub available_formats | ||||
| 88 | { | ||||
| 89 | my $self = shift; | ||||
| 90 | |||||
| 91 | # The various parens seem to be necessary to force uniq() to see | ||||
| 92 | # the caller's list context. Go figure. | ||||
| 93 | my @uniq = List::MoreUtils::uniq( map { keys %{ $_->_available_formats() || {} } } | ||||
| 94 | Class::ISA::self_and_super_path( ref $self ) ); | ||||
| 95 | |||||
| 96 | # Doing the sort in the same expression doesn't work under 5.6.x. | ||||
| 97 | return sort @uniq; | ||||
| 98 | } | ||||
| 99 | |||||
| 100 | # Just needed for the above method. | ||||
| 101 | sub _available_formats { } | ||||
| 102 | |||||
| 103 | 10 | 32µs | sub default_date_format_length { $_[0]->{default_date_format_length} } | ||
| 104 | |||||
| 105 | sub set_default_date_format_length | ||||
| 106 | { | ||||
| 107 | my $self = shift; | ||||
| 108 | my ($l) = validate_pos( @_, { regex => qr/^(?:full|long|medium|short)$/i } ); | ||||
| 109 | |||||
| 110 | $self->{default_date_format_length} = lc $l; | ||||
| 111 | } | ||||
| 112 | |||||
| 113 | 10 | 30µs | sub default_time_format_length { $_[0]->{default_time_format_length} } | ||
| 114 | |||||
| 115 | sub set_default_time_format_length | ||||
| 116 | { | ||||
| 117 | my $self = shift; | ||||
| 118 | my ($l) = validate_pos( @_, { regex => qr/^(?:full|long|medium|short)/i } ); | ||||
| 119 | |||||
| 120 | $self->{default_time_format_length} = lc $l; | ||||
| 121 | } | ||||
| 122 | |||||
| 123 | 1 | 900ns | for my $length ( qw( full long medium short ) ) | ||
| 124 | { | ||||
| 125 | 4 | 2µs | my $key = 'datetime_format_' . $length; | ||
| 126 | |||||
| 127 | my $sub = | ||||
| 128 | sub { my $self = shift; | ||||
| 129 | |||||
| 130 | return $self->{$key} if exists $self->{$key}; | ||||
| 131 | |||||
| 132 | my $date_meth = 'date_format_' . $length; | ||||
| 133 | my $time_meth = 'time_format_' . $length; | ||||
| 134 | |||||
| 135 | return $self->{$key} = $self->_make_datetime_format( $date_meth, $time_meth ); | ||||
| 136 | 4 | 7µs | }; | ||
| 137 | |||||
| 138 | 3 | 1.45ms | 2 | 30µs | # spent 19µs (8+11) within DateTime::Locale::Base::BEGIN@138 which was called
# once (8µs+11µs) by DateTime::Locale::BEGIN@10 at line 138 # spent 19µs making 1 call to DateTime::Locale::Base::BEGIN@138
# spent 11µs making 1 call to strict::unimport |
| 139 | 4 | 7µs | *{$key} = $sub; | ||
| 140 | } | ||||
| 141 | |||||
| 142 | sub datetime_format_default | ||||
| 143 | # spent 228µs (71+157) within DateTime::Locale::Base::datetime_format_default which was called 5 times, avg 46µs/call:
# 5 times (71µs+157µs) by DateTime::Locale::Base::default_datetime_format at line 255, avg 46µs/call | ||||
| 144 | 20 | 51µs | my $self = shift; | ||
| 145 | |||||
| 146 | my $date_meth = 'date_format_' . $self->default_date_format_length(); # spent 7µs making 5 calls to DateTime::Locale::Base::default_date_format_length, avg 1µs/call | ||||
| 147 | my $time_meth = 'time_format_' . $self->default_time_format_length(); # spent 6µs making 5 calls to DateTime::Locale::Base::default_time_format_length, avg 1µs/call | ||||
| 148 | |||||
| 149 | return $self->_make_datetime_format( $date_meth, $time_meth ); # spent 144µs making 5 calls to DateTime::Locale::Base::_make_datetime_format, avg 29µs/call | ||||
| 150 | } | ||||
| 151 | |||||
| 152 | sub _make_datetime_format | ||||
| 153 | # spent 144µs (96+48) within DateTime::Locale::Base::_make_datetime_format which was called 5 times, avg 29µs/call:
# 5 times (96µs+48µs) by DateTime::Locale::Base::datetime_format_default at line 149, avg 29µs/call | ||||
| 154 | 45 | 104µs | my $self = shift; | ||
| 155 | my $date_meth = shift; | ||||
| 156 | my $time_meth = shift; | ||||
| 157 | |||||
| 158 | my $dt_format = $self->datetime_format(); # spent 12µs making 5 calls to DateTime::Locale::en::datetime_format, avg 2µs/call | ||||
| 159 | |||||
| 160 | my $time = $self->$time_meth(); # spent 5µs making 5 calls to DateTime::Locale::en::time_format_medium, avg 940ns/call | ||||
| 161 | my $date = $self->$date_meth(); # spent 5µs making 5 calls to DateTime::Locale::en::date_format_medium, avg 920ns/call | ||||
| 162 | |||||
| 163 | $dt_format =~ s/\{0\}/$time/g; # spent 15µs making 5 calls to DateTime::Locale::Base::CORE:subst, avg 3µs/call | ||||
| 164 | $dt_format =~ s/\{1\}/$date/g; # spent 11µs making 5 calls to DateTime::Locale::Base::CORE:subst, avg 2µs/call | ||||
| 165 | |||||
| 166 | return $dt_format; | ||||
| 167 | } | ||||
| 168 | |||||
| 169 | sub prefers_24_hour_time | ||||
| 170 | { | ||||
| 171 | my $self = shift; | ||||
| 172 | |||||
| 173 | return $self->{prefers_24_hour_time} | ||||
| 174 | if exists $self->{prefers_24_hour_time}; | ||||
| 175 | |||||
| 176 | $self->{prefers_24_hour_time} = | ||||
| 177 | $self->time_format_short() =~ /h|K/ ? 0 : 1; | ||||
| 178 | } | ||||
| 179 | |||||
| 180 | # Backwards compat for DateTime.pm version <= 0.42 | ||||
| 181 | sub month_name { $_[0]->month_format_wide()-> [ $_[1]->month_0 ] } | ||||
| 182 | sub month_abbreviation { $_[0]->month_format_abbreviated()->[ $_[1]->month_0 ] } | ||||
| 183 | sub month_narrow { $_[0]->month_format_narrow()-> [ $_[1]->month_0 ] } | ||||
| 184 | |||||
| 185 | 5 | 20µs | 5 | 8µs | # spent 34µs (26+8) within DateTime::Locale::Base::month_names which was called 5 times, avg 7µs/call:
# 5 times (26µs+8µs) by DateTime::Format::Strptime::_build_parser at line 682 of DateTime/Format/Strptime.pm, avg 7µs/call # spent 8µs making 5 calls to DateTime::Locale::en::month_format_wide, avg 2µs/call |
| 186 | 5 | 22µs | 5 | 9µs | # spent 33µs (24+9) within DateTime::Locale::Base::month_abbreviations which was called 5 times, avg 7µs/call:
# 5 times (24µs+9µs) by DateTime::Format::Strptime::_build_parser at line 682 of DateTime/Format/Strptime.pm, avg 7µs/call # spent 9µs making 5 calls to DateTime::Locale::en::month_format_abbreviated, avg 2µs/call |
| 187 | sub month_narrows { $_[0]->month_format_narrow() } | ||||
| 188 | |||||
| 189 | sub day_name { $_[0]->day_format_wide()-> [ $_[1]->day_of_week_0 ] } | ||||
| 190 | sub day_abbreviation { $_[0]->day_format_abbreviated()->[ $_[1]->day_of_week_0 ] } | ||||
| 191 | sub day_narrow { $_[0]->day_format_narrow()-> [ $_[1]->day_of_week_0 ] } | ||||
| 192 | |||||
| 193 | 5 | 21µs | 5 | 10µs | # spent 36µs (27+10) within DateTime::Locale::Base::day_names which was called 5 times, avg 7µs/call:
# 5 times (27µs+10µs) by DateTime::Format::Strptime::_build_parser at line 671 of DateTime/Format/Strptime.pm, avg 7µs/call # spent 10µs making 5 calls to DateTime::Locale::en::day_format_wide, avg 2µs/call |
| 194 | 5 | 21µs | 5 | 8µs | # spent 32µs (24+8) within DateTime::Locale::Base::day_abbreviations which was called 5 times, avg 6µs/call:
# 5 times (24µs+8µs) by DateTime::Format::Strptime::_build_parser at line 671 of DateTime/Format/Strptime.pm, avg 6µs/call # spent 8µs making 5 calls to DateTime::Locale::en::day_format_abbreviated, avg 2µs/call |
| 195 | sub day_narrows { $_[0]->day_format_narrow() } | ||||
| 196 | |||||
| 197 | sub quarter_name { $_[0]->quarter_format_wide()-> [ $_[1]->quarter - 1 ] } | ||||
| 198 | sub quarter_abbreviation { $_[0]->quarter_format_abbreviated()->[ $_[1]->quarter - 1 ] } | ||||
| 199 | sub quarter_narrow { $_[0]->quarter_format_narrow()-> [ $_[1]->quarter - 1 ] } | ||||
| 200 | |||||
| 201 | sub quarter_names { $_[0]->quarter_format_wide() } | ||||
| 202 | sub quarter_abbreviations { $_[0]->quarter_format_abbreviated() } | ||||
| 203 | |||||
| 204 | sub am_pm { $_[0]->am_pm_abbreviated()->[ $_[1]->hour < 12 ? 0 : 1 ] } | ||||
| 205 | 10 | 44µs | 10 | 18µs | # spent 70µs (52+18) within DateTime::Locale::Base::am_pms which was called 10 times, avg 7µs/call:
# 5 times (31µs+11µs) by DateTime::Format::Strptime::_build_parser at line 610 of DateTime/Format/Strptime.pm, avg 8µs/call
# 5 times (21µs+7µs) by DateTime::Format::Strptime::parse_datetime at line 469 of DateTime/Format/Strptime.pm, avg 6µs/call # spent 18µs making 10 calls to DateTime::Locale::en::am_pm_abbreviated, avg 2µs/call |
| 206 | |||||
| 207 | sub era_name { $_[0]->era_wide()-> [ $_[1]->ce_year < 0 ? 0 : 1 ] } | ||||
| 208 | sub era_abbreviation { $_[0]->era_abbreviated()->[ $_[1]->ce_year < 0 ? 0 : 1 ] } | ||||
| 209 | sub era_narrow { $_[0]->era_narrow()-> [ $_[1]->ce_year < 0 ? 0 : 1 ] } | ||||
| 210 | |||||
| 211 | sub era_names { $_[0]->era_wide() } | ||||
| 212 | sub era_abbreviations { $_[0]->era_abbreviated() } | ||||
| 213 | |||||
| 214 | # ancient backwards compat | ||||
| 215 | sub era { $_[0]->era_abbreviation } | ||||
| 216 | sub eras { $_[0]->era_abbreviations } | ||||
| 217 | |||||
| 218 | sub date_before_time | ||||
| 219 | { | ||||
| 220 | my $self = shift; | ||||
| 221 | |||||
| 222 | my $dt_format = $self->datetime_format(); | ||||
| 223 | |||||
| 224 | return $dt_format =~ /\{1\}.*\{0\}/ ? 1 : 0; | ||||
| 225 | } | ||||
| 226 | |||||
| 227 | sub date_parts_order | ||||
| 228 | { | ||||
| 229 | my $self = shift; | ||||
| 230 | |||||
| 231 | my $short = $self->date_format_short(); | ||||
| 232 | |||||
| 233 | $short =~ tr{dmyDMY}{}cd; | ||||
| 234 | $short =~ tr{dmyDMY}{dmydmy}s; | ||||
| 235 | |||||
| 236 | return $short; | ||||
| 237 | } | ||||
| 238 | |||||
| 239 | sub full_date_format { $_[0]->_convert_to_strftime( $_[0]->date_format_full() ) } | ||||
| 240 | sub long_date_format { $_[0]->_convert_to_strftime( $_[0]->date_format_long() ) } | ||||
| 241 | sub medium_date_format { $_[0]->_convert_to_strftime( $_[0]->date_format_medium() ) } | ||||
| 242 | sub short_date_format { $_[0]->_convert_to_strftime( $_[0]->date_format_short() ) } | ||||
| 243 | 5 | 41µs | 10 | 296µs | # spent 344µs (48+296) within DateTime::Locale::Base::default_date_format which was called 5 times, avg 69µs/call:
# 5 times (48µs+296µs) by DateTime::Format::Strptime::_build_parser at line 613 of DateTime/Format/Strptime.pm, avg 69µs/call # spent 221µs making 5 calls to DateTime::Locale::Base::_convert_to_strftime, avg 44µs/call
# spent 75µs making 5 calls to DateTime::Locale::Base::date_format_default, avg 15µs/call |
| 244 | |||||
| 245 | sub full_time_format { $_[0]->_convert_to_strftime( $_[0]->time_format_full() ) } | ||||
| 246 | sub long_time_format { $_[0]->_convert_to_strftime( $_[0]->time_format_long() ) } | ||||
| 247 | sub medium_time_format { $_[0]->_convert_to_strftime( $_[0]->time_format_medium() ) } | ||||
| 248 | sub short_time_format { $_[0]->_convert_to_strftime( $_[0]->time_format_short() ) } | ||||
| 249 | 5 | 32µs | 10 | 553µs | # spent 595µs (42+553) within DateTime::Locale::Base::default_time_format which was called 5 times, avg 119µs/call:
# 5 times (42µs+553µs) by DateTime::Format::Strptime::_build_parser at line 617 of DateTime/Format/Strptime.pm, avg 119µs/call # spent 479µs making 5 calls to DateTime::Locale::Base::_convert_to_strftime, avg 96µs/call
# spent 74µs making 5 calls to DateTime::Locale::Base::time_format_default, avg 15µs/call |
| 250 | |||||
| 251 | sub full_datetime_format { $_[0]->_convert_to_strftime( $_[0]->datetime_format_full() ) } | ||||
| 252 | sub long_datetime_format { $_[0]->_convert_to_strftime( $_[0]->datetime_format_long() ) } | ||||
| 253 | sub medium_datetime_format { $_[0]->_convert_to_strftime( $_[0]->datetime_format_medium() ) } | ||||
| 254 | sub short_datetime_format { $_[0]->_convert_to_strftime( $_[0]->datetime_format_short() ) } | ||||
| 255 | 5 | 33µs | 10 | 774µs | # spent 814µs (40+774) within DateTime::Locale::Base::default_datetime_format which was called 5 times, avg 163µs/call:
# 5 times (40µs+774µs) by DateTime::Format::Strptime::_build_parser at line 621 of DateTime/Format/Strptime.pm, avg 163µs/call # spent 546µs making 5 calls to DateTime::Locale::Base::_convert_to_strftime, avg 109µs/call
# spent 228µs making 5 calls to DateTime::Locale::Base::datetime_format_default, avg 46µs/call |
| 256 | |||||
| 257 | # Older versions of DateTime.pm will not pass in the $cldr_ok flag, so | ||||
| 258 | # we will give them the converted-to-strftime pattern (bugs and all). | ||||
| 259 | sub _convert_to_strftime | ||||
| 260 | # spent 1.25ms (84µs+1.16) within DateTime::Locale::Base::_convert_to_strftime which was called 15 times, avg 83µs/call:
# 5 times (19µs+526µs) by DateTime::Locale::Base::default_datetime_format at line 255, avg 109µs/call
# 5 times (21µs+457µs) by DateTime::Locale::Base::default_time_format at line 249, avg 96µs/call
# 5 times (43µs+178µs) by DateTime::Locale::Base::default_date_format at line 243, avg 44µs/call | ||||
| 261 | 78 | 89µs | my $self = shift; | ||
| 262 | my $pattern = shift; | ||||
| 263 | my $cldr_ok = shift; | ||||
| 264 | |||||
| 265 | return $pattern if $cldr_ok; | ||||
| 266 | |||||
| 267 | return $self->{_converted_patterns}{$pattern} | ||||
| 268 | if exists $self->{_converted_patterns}{$pattern}; | ||||
| 269 | |||||
| 270 | return $self->{_converted_patterns}{$pattern} = $self->_cldr_to_strftime($pattern); # spent 1.16ms making 3 calls to DateTime::Locale::Base::_cldr_to_strftime, avg 387µs/call | ||||
| 271 | } | ||||
| 272 | |||||
| 273 | { | ||||
| 274 | 2 | 69µs | 29 | 24µs | my @JavaPatterns = # spent 24µs making 29 calls to DateTime::Locale::Base::CORE:qr, avg 817ns/call |
| 275 | ( qr/G/ => '{era}', | ||||
| 276 | qr/yyyy/ => '{ce_year}', | ||||
| 277 | qr/y/ => 'y', | ||||
| 278 | qr/u/ => 'Y', | ||||
| 279 | qr/MMMM/ => 'B', | ||||
| 280 | qr/MMM/ => 'b', | ||||
| 281 | qr/MM/ => 'm', | ||||
| 282 | qr/M/ => '{month}', | ||||
| 283 | qr/dd/ => 'd', | ||||
| 284 | qr/d/ => '{day}', | ||||
| 285 | qr/hh/ => 'l', | ||||
| 286 | qr/h/ => '{hour_12}', | ||||
| 287 | qr/HH/ => 'H', | ||||
| 288 | qr/H/ => '{hour}', | ||||
| 289 | qr/mm/ => 'M', | ||||
| 290 | qr/m/ => '{minute}', | ||||
| 291 | qr/ss/ => 'S', | ||||
| 292 | qr/s/ => '{second}', | ||||
| 293 | qr/S/ => 'N', | ||||
| 294 | qr/EEEE/ => 'A', | ||||
| 295 | qr/E/ => 'a', | ||||
| 296 | qr/D/ => 'j', | ||||
| 297 | qr/F/ => '{weekday_of_month}', | ||||
| 298 | qr/w/ => 'V', | ||||
| 299 | qr/W/ => '{week_month}', | ||||
| 300 | qr/a/ => 'p', | ||||
| 301 | qr/k/ => '{hour_1}', | ||||
| 302 | qr/K/ => '{hour_12_0}', | ||||
| 303 | qr/z/ => '{time_zone_long_name}', | ||||
| 304 | ); | ||||
| 305 | |||||
| 306 | sub _cldr_to_strftime | ||||
| 307 | # spent 1.16ms (104µs+1.06) within DateTime::Locale::Base::_cldr_to_strftime which was called 3 times, avg 387µs/call:
# 3 times (104µs+1.06ms) by DateTime::Locale::Base::_convert_to_strftime at line 270, avg 387µs/call | ||||
| 308 | 26 | 148µs | shift; | ||
| 309 | my $simple = shift; | ||||
| 310 | |||||
| 311 | $simple =~ | ||||
| 312 | s/(G+|y+|u+|M+|d+|h+|H+|m+|s+|S+|E+|D+|F+|w+|W+|a+|k+|K+|z+)|'((?:[^']|'')*)'/ # spent 47µs making 17 calls to DateTime::Locale::Base::CORE:substcont, avg 3µs/call
# spent 10µs making 3 calls to DateTime::Locale::Base::CORE:subst, avg 3µs/call | ||||
| 313 | $2 ? _stringify($2) : $1 ? _convert($1) : "'"/eg; # spent 1.00ms making 14 calls to DateTime::Locale::Base::_convert, avg 71µs/call | ||||
| 314 | |||||
| 315 | return $simple; | ||||
| 316 | } | ||||
| 317 | |||||
| 318 | sub _convert | ||||
| 319 | # spent 1.00ms (779µs+221µs) within DateTime::Locale::Base::_convert which was called 14 times, avg 71µs/call:
# 14 times (779µs+221µs) by DateTime::Locale::Base::_cldr_to_strftime at line 313, avg 71µs/call | ||||
| 320 | 220 | 969µs | my $simple = shift; | ||
| 321 | |||||
| 322 | for ( my $x = 0; $x < @JavaPatterns; $x += 2 ) | ||||
| 323 | { | ||||
| 324 | return '%' . $JavaPatterns[ $x + 1 ] if $simple =~ /$JavaPatterns[$x]/; # spent 171µs making 178 calls to DateTime::Locale::Base::CORE:regcomp, avg 963ns/call
# spent 50µs making 178 calls to DateTime::Locale::Base::CORE:match, avg 278ns/call | ||||
| 325 | } | ||||
| 326 | |||||
| 327 | die "**Dont know $simple***"; | ||||
| 328 | } | ||||
| 329 | |||||
| 330 | sub _stringify | ||||
| 331 | { | ||||
| 332 | my $string = shift; | ||||
| 333 | |||||
| 334 | $string =~ s/%(?:[^%])/%%/g; | ||||
| 335 | $string =~ s/\'\'/\'/g; | ||||
| 336 | |||||
| 337 | return $string; | ||||
| 338 | } | ||||
| 339 | } | ||||
| 340 | |||||
| 341 | # end backwards compat | ||||
| 342 | |||||
| 343 | sub STORABLE_freeze | ||||
| 344 | # spent 139µs (93+46) within DateTime::Locale::Base::STORABLE_freeze which was called 13 times, avg 11µs/call:
# 13 times (93µs+46µs) by Storable::net_mstore at line 339 of Storable.pm, avg 11µs/call | ||||
| 345 | 52 | 81µs | my $self = shift; | ||
| 346 | my $cloning = shift; | ||||
| 347 | |||||
| 348 | return if $cloning; | ||||
| 349 | |||||
| 350 | return $self->id(); # spent 46µs making 13 calls to DateTime::Locale::Base::__ANON__[DateTime/Locale/Base.pm:26], avg 4µs/call | ||||
| 351 | } | ||||
| 352 | |||||
| 353 | sub STORABLE_thaw | ||||
| 354 | # spent 1.30ms (454µs+849µs) within DateTime::Locale::Base::STORABLE_thaw which was called 17 times, avg 77µs/call:
# 17 times (454µs+849µs) by Storable::mretrieve at line 415 of Storable.pm, avg 77µs/call | ||||
| 355 | 102 | 413µs | my $self = shift; | ||
| 356 | my $cloning = shift; | ||||
| 357 | my $serialized = shift; | ||||
| 358 | |||||
| 359 | my $obj = DateTime::Locale->load( $serialized ); # spent 849µs making 17 calls to DateTime::Locale::load, avg 50µs/call | ||||
| 360 | |||||
| 361 | %$self = %$obj; | ||||
| 362 | |||||
| 363 | return $self; | ||||
| 364 | } | ||||
| 365 | |||||
| 366 | |||||
| 367 | 1 | 19µs | 1; | ||
| 368 | |||||
| 369 | __END__ | ||||
| 370 | |||||
| 371 | =head1 NAME | ||||
| 372 | |||||
| 373 | DateTime::Locale::Base - Base class for individual locale objects | ||||
| 374 | |||||
| 375 | =head1 SYNOPSIS | ||||
| 376 | |||||
| 377 | use base 'DateTime::Locale::Base'; | ||||
| 378 | |||||
| 379 | =head1 DEFAULT FORMATS | ||||
| 380 | |||||
| 381 | Each locale has a set of four default date and time formats. They are | ||||
| 382 | distinguished by length, and are called "full", "long", "medium", and | ||||
| 383 | "short". Each locale may have a different default length which it uses | ||||
| 384 | when its C<< $locale->date_format_default() >>, C<< | ||||
| 385 | $locale->time_format_default() >>, or C<< | ||||
| 386 | $locale->datetime_format_default() >> methods are called. | ||||
| 387 | |||||
| 388 | This can be changed by calling the C<< | ||||
| 389 | $locale->set_default_date_format() >> or C<< | ||||
| 390 | $locale->set_default_time_format() >> methods. These methods accept a | ||||
| 391 | string which must be one of "full", "long", "medium", or "short". | ||||
| 392 | |||||
| 393 | =head1 NAME FORMS | ||||
| 394 | |||||
| 395 | Most names come in a number of variations. First, they may vary based | ||||
| 396 | on length, with wide, abbreviated, and narrow forms. The wide form is | ||||
| 397 | typically the full name, while the narrow form is often a single | ||||
| 398 | character. The narrow forms may not be unique. For example, "T" may be | ||||
| 399 | used for Tuesday and Thursday in the English narrow forms. | ||||
| 400 | |||||
| 401 | Many names also distinguish between "format" and "stand-alone" forms | ||||
| 402 | of a pattern. The format pattern is used when the thing in question is | ||||
| 403 | being placed into a larger string. The stand-alone form is used when | ||||
| 404 | displaying that item by itself, for example in a calendar. | ||||
| 405 | |||||
| 406 | =head1 METHODS | ||||
| 407 | |||||
| 408 | All locales provide the following methods: | ||||
| 409 | |||||
| 410 | =over 4 | ||||
| 411 | |||||
| 412 | =item * $locale->id() | ||||
| 413 | |||||
| 414 | The locale's id. | ||||
| 415 | |||||
| 416 | =item * $locale->language_id() | ||||
| 417 | |||||
| 418 | The language portion of the id. | ||||
| 419 | |||||
| 420 | =item * $locale->script_id() | ||||
| 421 | |||||
| 422 | The script portion of the id, if any. | ||||
| 423 | |||||
| 424 | =item * $locale->territory_id() | ||||
| 425 | |||||
| 426 | The territory portion of the id, if any. | ||||
| 427 | |||||
| 428 | =item * $locale->variant_id() | ||||
| 429 | |||||
| 430 | The variant portion of the id, if any. | ||||
| 431 | |||||
| 432 | =item * $locale->name() | ||||
| 433 | |||||
| 434 | The full name for the locale in English. | ||||
| 435 | |||||
| 436 | =item * $locale->language() | ||||
| 437 | |||||
| 438 | The language name for the locale in English. | ||||
| 439 | |||||
| 440 | =item * $locale->script() | ||||
| 441 | |||||
| 442 | The script name for the locale in English, if any. | ||||
| 443 | |||||
| 444 | =item * $locale->territory() | ||||
| 445 | |||||
| 446 | The territory name for the locale in English, if any. | ||||
| 447 | |||||
| 448 | =item * $locale->variant() | ||||
| 449 | |||||
| 450 | The variant name for the locale in English, if any. | ||||
| 451 | |||||
| 452 | =item * $locale->native_name() | ||||
| 453 | |||||
| 454 | The full name for the locale in its native language, if any. | ||||
| 455 | |||||
| 456 | =item * $locale->native_language() | ||||
| 457 | |||||
| 458 | The language name for the locale in its native language, if any. | ||||
| 459 | |||||
| 460 | =item * $locale->native_script() | ||||
| 461 | |||||
| 462 | The script name for the locale in its native language, if any. | ||||
| 463 | |||||
| 464 | =item * $locale->native_territory() | ||||
| 465 | |||||
| 466 | The territory name for the locale in its native language, if any. | ||||
| 467 | |||||
| 468 | =item * $locale->native_variant() | ||||
| 469 | |||||
| 470 | The variant name for the locale in its native language, if any. | ||||
| 471 | |||||
| 472 | =item * $locale->month_format_wide() | ||||
| 473 | |||||
| 474 | Returns an array reference containing the wide format names of the | ||||
| 475 | months, with January as the first month. | ||||
| 476 | |||||
| 477 | =item * $locale->month_format_abbreviated() | ||||
| 478 | |||||
| 479 | Returns an array reference containing the abbreviated format names of | ||||
| 480 | the months, with January as the first month. | ||||
| 481 | |||||
| 482 | =item * $locale->month_format_narrow() | ||||
| 483 | |||||
| 484 | Returns an array reference containing the narrow format names of the | ||||
| 485 | months, with January as the first month. | ||||
| 486 | |||||
| 487 | =item * $locale->month_stand_alone_wide() | ||||
| 488 | |||||
| 489 | Returns an array reference containing the wide stand-alone names of | ||||
| 490 | the months, with January as the first month. | ||||
| 491 | |||||
| 492 | =item * $locale->month_stand_alone_abbreviated() | ||||
| 493 | |||||
| 494 | Returns an array reference containing the abbreviated stand-alone | ||||
| 495 | names of the months, with January as the first month. | ||||
| 496 | |||||
| 497 | =item * $locale->month_stand_alone_narrow() | ||||
| 498 | |||||
| 499 | Returns an array reference containing the narrow stand-alone names of the | ||||
| 500 | months, with January as the first month. | ||||
| 501 | |||||
| 502 | =item * $locale->day_format_wide() | ||||
| 503 | |||||
| 504 | Returns an array reference containing the wide format names of the | ||||
| 505 | days, with Monday as the first day. | ||||
| 506 | |||||
| 507 | =item * $locale->day_format_abbreviated() | ||||
| 508 | |||||
| 509 | Returns an array reference containing the abbreviated format names of | ||||
| 510 | the days, with Monday as the first day. | ||||
| 511 | |||||
| 512 | =item * $locale->day_format_narrow() | ||||
| 513 | |||||
| 514 | Returns an array reference containing the narrow format names of the | ||||
| 515 | days, with Monday as the first day. | ||||
| 516 | |||||
| 517 | =item * $locale->day_stand_alone_wide() | ||||
| 518 | |||||
| 519 | Returns an array reference containing the wide stand-alone names of | ||||
| 520 | the days, with Monday as the first day. | ||||
| 521 | |||||
| 522 | =item * $locale->day_stand_alone_abbreviated() | ||||
| 523 | |||||
| 524 | Returns an array reference containing the abbreviated stand-alone | ||||
| 525 | names of the days, with Monday as the first day. | ||||
| 526 | |||||
| 527 | =item * $locale->day_stand_alone_narrow() | ||||
| 528 | |||||
| 529 | Returns an array reference containing the narrow stand-alone names of | ||||
| 530 | the days, with Monday as the first day. | ||||
| 531 | |||||
| 532 | =item * $locale->quarter_format_wide() | ||||
| 533 | |||||
| 534 | Returns an array reference containing the wide format names of the | ||||
| 535 | quarters. | ||||
| 536 | |||||
| 537 | =item * $locale->quarter_format_abbreviated() | ||||
| 538 | |||||
| 539 | Returns an array reference containing the abbreviated format names of | ||||
| 540 | the quarters. | ||||
| 541 | |||||
| 542 | =item * $locale->quarter_format_narrow() | ||||
| 543 | |||||
| 544 | Returns an array reference containing the narrow format names of the | ||||
| 545 | quarters. | ||||
| 546 | |||||
| 547 | =item * $locale->quarter_stand_alone_wide() | ||||
| 548 | |||||
| 549 | Returns an array reference containing the wide stand-alone names of | ||||
| 550 | the quarters. | ||||
| 551 | |||||
| 552 | =item * $locale->quarter_stand_alone_abbreviated() | ||||
| 553 | |||||
| 554 | Returns an array reference containing the abbreviated stand-alone | ||||
| 555 | names of the quarters. | ||||
| 556 | |||||
| 557 | =item * $locale->quarter_stand_alone_narrow() | ||||
| 558 | |||||
| 559 | Returns an array reference containing the narrow stand-alone names of the | ||||
| 560 | quarters. | ||||
| 561 | |||||
| 562 | =item * $locale->era_wide() | ||||
| 563 | |||||
| 564 | Returns an array reference containing the wide names of the eras, with | ||||
| 565 | "BCE" first. | ||||
| 566 | |||||
| 567 | =item * $locale->era_abbreviated() | ||||
| 568 | |||||
| 569 | Returns an array reference containing the abbreviated names of the | ||||
| 570 | eras, with "BCE" first. | ||||
| 571 | |||||
| 572 | =item * $locale->era_narrow() | ||||
| 573 | |||||
| 574 | Returns an array reference containing the abbreviated names of the | ||||
| 575 | eras, with "BCE" first. However, most locales do not differ between | ||||
| 576 | the narrow and abbreviated length of the era. | ||||
| 577 | |||||
| 578 | =item * $locale->am_pm_abbreviated() | ||||
| 579 | |||||
| 580 | Returns an array reference containing the abbreviated names of "AM" | ||||
| 581 | and "PM". | ||||
| 582 | |||||
| 583 | =item * $locale->date_format_long() | ||||
| 584 | |||||
| 585 | =item * $locale->date_format_full() | ||||
| 586 | |||||
| 587 | =item * $locale->date_format_medium() | ||||
| 588 | |||||
| 589 | =item * $locale->date_format_short() | ||||
| 590 | |||||
| 591 | Returns the CLDR date pattern of the appropriate length. | ||||
| 592 | |||||
| 593 | =item * $locale->date_formats() | ||||
| 594 | |||||
| 595 | Returns a hash reference of CLDR date patterns for the date formats, | ||||
| 596 | where the keys are "full", "long", "medium", and "short". | ||||
| 597 | |||||
| 598 | =item * $locale->time_format_long() | ||||
| 599 | |||||
| 600 | =item * $locale->time_format_full() | ||||
| 601 | |||||
| 602 | =item * $locale->time_format_medium() | ||||
| 603 | |||||
| 604 | =item * $locale->time_format_short() | ||||
| 605 | |||||
| 606 | Returns the CLDR date pattern of the appropriate length. | ||||
| 607 | |||||
| 608 | =item * $locale->time_formats() | ||||
| 609 | |||||
| 610 | Returns a hash reference of CLDR date patterns for the time formats, | ||||
| 611 | where the keys are "full", "long", "medium", and "short". | ||||
| 612 | |||||
| 613 | =item * $locale->datetime_format_long() | ||||
| 614 | |||||
| 615 | =item * $locale->datetime_format_full() | ||||
| 616 | |||||
| 617 | =item * $locale->datetime_format_medium() | ||||
| 618 | |||||
| 619 | =item * $locale->datetime_format_short() | ||||
| 620 | |||||
| 621 | Returns the CLDR date pattern of the appropriate length. | ||||
| 622 | |||||
| 623 | =item * $locale->datetime_formats() | ||||
| 624 | |||||
| 625 | Returns a hash reference of CLDR date patterns for the datetime | ||||
| 626 | formats, where the keys are "full", "long", "medium", and "short". | ||||
| 627 | |||||
| 628 | =item * $locale->date_format_default() | ||||
| 629 | |||||
| 630 | =item * $locale->time_format_default() | ||||
| 631 | |||||
| 632 | =item * $locale->datetime_format_default() | ||||
| 633 | |||||
| 634 | Returns the default CLDR date pattern. The length of this format is | ||||
| 635 | based on the value of C<< $locale->default_date_format_length() >> | ||||
| 636 | and/or C<< $locale->default_time_format_length() >>. | ||||
| 637 | |||||
| 638 | =item * $locale->default_date_format_length() | ||||
| 639 | |||||
| 640 | =item * $locale->default_time_format_length() | ||||
| 641 | |||||
| 642 | Returns the default length for the format, one of "full", "long", | ||||
| 643 | "medium", or "short". | ||||
| 644 | |||||
| 645 | =item * $locale->set_default_date_format_length() | ||||
| 646 | |||||
| 647 | =item * $locale->set_default_time_format_length() | ||||
| 648 | |||||
| 649 | Sets the default length for the format. This must be one of "full", | ||||
| 650 | "long", "medium", or "short". | ||||
| 651 | |||||
| 652 | =item * $locale->prefers_24_hour_time() | ||||
| 653 | |||||
| 654 | Returns a boolean indicating the preferred hour format for this | ||||
| 655 | locale. | ||||
| 656 | |||||
| 657 | =item * $locale->first_day_of_week() | ||||
| 658 | |||||
| 659 | Returns a number from 1 to 7 indicating the I<local> first day of the | ||||
| 660 | week. For example, for a US locale this returns 7. | ||||
| 661 | |||||
| 662 | =item * $locale->available_formats() | ||||
| 663 | |||||
| 664 | A list of format names, like "MMdd" or "yyyyMM". This should be the | ||||
| 665 | list directly supported by the subclass, not its parents. | ||||
| 666 | |||||
| 667 | =item * $locale->format_for($key) | ||||
| 668 | |||||
| 669 | Given a valid name, returns the CLDR date pattern for that thing, if | ||||
| 670 | one exists. | ||||
| 671 | |||||
| 672 | =back | ||||
| 673 | |||||
| 674 | =head1 SUPPORT | ||||
| 675 | |||||
| 676 | See L<DateTime::Locale>. | ||||
| 677 | |||||
| 678 | =head1 AUTHORS | ||||
| 679 | |||||
| 680 | Richard Evans <rich@ridas.com> | ||||
| 681 | |||||
| 682 | Dave Rolsky <autarch@urth.org> | ||||
| 683 | |||||
| 684 | =head1 COPYRIGHT | ||||
| 685 | |||||
| 686 | Copyright (c) 2003 Richard Evans. Copyright (c) 2004-2005 David | ||||
| 687 | Rolsky. All rights reserved. This program is free software; you can | ||||
| 688 | redistribute it and/or modify it under the same terms as Perl itself. | ||||
| 689 | |||||
| 690 | This program is free software; you can redistribute it and/or modify | ||||
| 691 | it under the same terms as Perl itself. | ||||
| 692 | |||||
| 693 | The full text of the license can be found in the LICENSE file included | ||||
| 694 | with this module. | ||||
| 695 | |||||
| 696 | =cut | ||||
# spent 50µs within DateTime::Locale::Base::CORE:match which was called 178 times, avg 278ns/call:
# 178 times (50µs+0s) by DateTime::Locale::Base::_convert at line 324 of DateTime/Locale/Base.pm, avg 278ns/call | |||||
# spent 24µs within DateTime::Locale::Base::CORE:qr which was called 29 times, avg 817ns/call:
# 29 times (24µs+0s) by DateTime::Locale::BEGIN@10 at line 274 of DateTime/Locale/Base.pm, avg 817ns/call | |||||
# spent 171µs within DateTime::Locale::Base::CORE:regcomp which was called 178 times, avg 963ns/call:
# 178 times (171µs+0s) by DateTime::Locale::Base::_convert at line 324 of DateTime/Locale/Base.pm, avg 963ns/call | |||||
# spent 47µs within DateTime::Locale::Base::CORE:subst which was called 35 times, avg 1µs/call:
# 11 times (6µs+0s) by DateTime::Locale::Base::BEGIN@12 at line 20 of DateTime/Locale/Base.pm, avg 527ns/call
# 11 times (4µs+0s) by DateTime::Locale::Base::BEGIN@12 at line 23 of DateTime/Locale/Base.pm, avg 364ns/call
# 5 times (15µs+0s) by DateTime::Locale::Base::_make_datetime_format at line 163 of DateTime/Locale/Base.pm, avg 3µs/call
# 5 times (11µs+0s) by DateTime::Locale::Base::_make_datetime_format at line 164 of DateTime/Locale/Base.pm, avg 2µs/call
# 3 times (10µs+0s) by DateTime::Locale::Base::_cldr_to_strftime at line 312 of DateTime/Locale/Base.pm, avg 3µs/call | |||||
# spent 47µs within DateTime::Locale::Base::CORE:substcont which was called 17 times, avg 3µs/call:
# 17 times (47µs+0s) by DateTime::Locale::Base::_cldr_to_strftime at line 312 of DateTime/Locale/Base.pm, avg 3µs/call |