« blib/lib/Astro/App/Satpass2/ParseTime/Date/Manip.pm
↑ Summary
blib/lib/Astro/App/Satpass2/FormatTime/POSIX/Strftime.pm »
| 1 | package Astro::App::Satpass2::FormatTime::DateTime::Cldr; | ||
| 2 | |||
| 3 | use 5.008; | ||
| 4 | |||
| 5 | use strict; | ||
| 6 | use warnings; | ||
| 7 | |||
| 8 | use parent qw{ Astro::App::Satpass2::FormatTime::DateTime }; | ||
| 9 | |||
| 10 | use Astro::App::Satpass2::FormatTime::Cldr; | ||
| 11 | use Astro::App::Satpass2::Utils qw{ @CARP_NOT }; | ||
| 12 | use DateTime; | ||
| 13 | use DateTime::TimeZone; | ||
| 14 | use POSIX (); | ||
| 15 | |||
| 16 | our $VERSION = '0.059'; | ||
| 17 | |||
| 18 | # So superclass can ducktype the object that does the real work. | ||
| 19 | use constant METHOD_USED => 'format_cldr'; | ||
| 20 | |||
| 21 | sub __format_datetime { | ||
| 22 | my ( $self, $date_time, $tplt ) = @_; # Invocant unused | ||
| 23 | my $quoted = 0; | ||
| 24 | my $rslt; | ||
| 25 | foreach my $elem ( split qr{ ( ' ) }smx, $tplt ) { | ||
| 26 | if ( q<'> eq $elem ) { | ||
| 27 | $quoted = ! $quoted; | ||
| 28 | } elsif ( $quoted ) { | ||
| 29 | $elem = $self->__preprocess_strftime_format( | ||
| 30 | $date_time, $elem ); | ||
| 31 | } | ||
| 32 | $rslt .= $elem; | ||
| 33 | } | ||
| 34 | return $date_time->format_cldr( $rslt ); | ||
| 35 | } | ||
| 36 | |||
| 37 | 1; | ||
| 38 | |||
| 39 | __END__ |