Calendar-Japanese-Acme-Syukujitsu
view release on metacpan or search on metacpan
lib/Calendar/Japanese/Acme/Syukujitsu.pm view on Meta::CPAN
131415161718192021222324252627282930313233343536373839use
Smart::Args;
our
$VERSION
=
'0.01'
;
sub
new {
args
my
$class
,
my
$cachefile
=> {
optional
=> 1},
my
$endpoint
=> {
optional
=> 1};
my
$data
;
if
(
$cachefile
) {
$data
= read_file(
$cachefile
);
}
else
{
$endpoint
=
$endpoint
||
$DEFAULT_ENDPOINT
;
$data
= Furl->new()->get(
$endpoint
)->content;
}
Encode::from_to(
$data
,
'sjis'
,
'utf-8'
);
my
$syukujitsus
= {};
for
my
$line
(
split
/\n/,
$data
) {
chop
(
$line
)
if
$line
=~ /(\n|\r|\n\r)$/;
my
(
$date
,
$syukujitsu_name
) =
split
/,/,
$line
;
my
(
$year
,
$month
,
$day
) =
split
/-/,
$date
;
next
unless
$day
;
lib/Calendar/Japanese/Acme/Syukujitsu.pm view on Meta::CPAN
106107108109110111112113114115116117118119120121122123124125
$name
= is_syukujitsu(2017, 9, 11);
=head1 DESCRIPTION
This module read Syukujitsu information from
F<syukujitsu.csv> that published by Japanese government.
With interface that referenced to C<Calendar::Japanese::Holiday>.
=head1 METHODS
=head2 new([cachefile => $cachefile][endpoint => $endpoint])
Constructor.
=head2 get_syukujitsus(year => $year [, month => $month [, day => $day]])
=head2 is_syukujitsu(year => $year, month => $month, day => $day)
=head1 AUTHOR
Nao Muto <n@o625.com>
( run in 0.576 second using v1.01-cache-2.11-cpan-49f99fa48dc )