App-week

 view release on metacpan or  search on metacpan

README.md  view on Meta::CPAN

# WEEK NUMBER

Using option **-W** or **--weeknumber**, week number is printed at the
end of every week line.  Week number 1 is a week which include January
1st and count up on every Sunday.

Experimentally option **-W2** print the _standard week number_ which
start with the first Sunday of the year, and **-W3** print ISO 8601
style week number.  Because ISO week start on Monday, and the command
shows a number of Sunday of the week, the result is not intuitive and
therefore, I guess, useless.  This option requires [gcal(1)](http://man.he.net/man1/gcal) command
installed.

# COLORMAP

Each field is labeled by names.

    FRAME       Enclosing frame
    MONTH       Month name
    WEEK        Day of the week
    DAYS        Calendar

lib/App/week.pm  view on Meta::CPAN

    use Getopt::EX::Long qw(:DEFAULT Configure ExConfigure);
    ExConfigure BASECLASS => [ "App::week", "Getopt::EX", "" ];
    Configure qw(bundling no_getopt_compat no_ignore_case pass_through);
    $app->getopt || usage;
    return $app;
}

sub argv {
    my $app = shift;
    for (@{$app->ARGV}) {
	call \&guess_date,
	    for  => $app,
	    with => [ qw(year mon mday show_year) ];
    }
    return $app;
}

sub deal_option {
    my $app = shift;

    # load --colormap option

lib/App/week/Util.pm  view on Meta::CPAN

	( $a => $b, substr($b, 0, 1) => $b )
    }
    map { split /:/ }
    qw( M:明治 T:大正 S:昭和 H:平成 R:令和 );
};

my @month_name = qw(JAN FEB MAR APR MAY JUN JUL AUG SEP OCT NOV DEC);
my %month = map { $month_name[$_] => $_ + 1 } 0 .. $#month_name;
my $month_re = do { local $" = '|'; qr/(?:@month_name)/i };

sub guess_date {
    my $__ = $_;
    my @args = \(
	my($year, $mon, $mday, $show_year) = @_
    );

    # Jan ... Dec
    if (/^($month_re)/) {
	$mon = $month{uc($1)};
    }
    elsif (m{

script/week  view on Meta::CPAN

=head1 WEEK NUMBER

Using option B<-W> or B<--weeknumber>, week number is printed at the
end of every week line.  Week number 1 is a week which include January
1st and count up on every Sunday.

Experimentally option B<-W2> print the I<standard week number> which
start with the first Sunday of the year, and B<-W3> print ISO 8601
style week number.  Because ISO week start on Monday, and the command
shows a number of Sunday of the week, the result is not intuitive and
therefore, I guess, useless.  This option requires L<gcal(1)> command
installed.

=head1 COLORMAP

Each field is labeled by names.

    FRAME       Enclosing frame
    MONTH       Month name
    WEEK        Day of the week
    DAYS        Calendar



( run in 1.564 second using v1.01-cache-2.11-cpan-748bfb374f4 )