Calendar-Japanese-Acme-Syukujitsu
view release on metacpan or search on metacpan
lib/Calendar/Japanese/Acme/Syukujitsu.pm view on Meta::CPAN
use List::Util qw(max min);
use Smart::Args;
our $VERSION = '0.01';
our $DEFAULT_ENDPOINT = 'http://www8.cao.go.jp/chosei/shukujitsu/syukujitsu.csv';
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
$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.928 second using v1.01-cache-2.11-cpan-49f99fa48dc )