« TableData/Perl/CPAN/Release/Static/GroupedDaily.pm
↑ Summary
TableData/Perl/CPAN/Release/Static.pm »
| 1 | package TableData::Perl::CPAN::Release::Static::GroupedMonthly; | ||||||||||||||||||||||||||||
| 2 | |||||||||||||||||||||||||||||
| 3 | 1 | ▶ | use 5.010001; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 4 | 1 | ▶ | use strict; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 5 | 1 | ▶ | use warnings; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 6 | |||||||||||||||||||||||||||||
| 7 | 1 | ▶ | use parent 'TableData::Munge::GroupRows'; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 8 | |||||||||||||||||||||||||||||
| 9 | 1 | ▶ | use DateTime; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 10 | |||||||||||||||||||||||||||||
| 11 | 1 | our $AUTHORITY = 'cpan:PERLANCAR'; # AUTHORITY | |||||||||||||||||||||||||||
| 12 | 1 | our $DATE = '2023-12-28'; # DATE | |||||||||||||||||||||||||||
| 13 | 1 | our $DIST = 'TableDataBundle-Perl-CPAN-Release'; # DIST | |||||||||||||||||||||||||||
| 14 | 1 | our $VERSION = '20231228.0'; # VERSION | |||||||||||||||||||||||||||
| 15 | |||||||||||||||||||||||||||||
| 16 | 1 | my $re_period = qr/\A(\d\d\d\d)-(\d\d)/; | |||||||||||||||||||||||||||
| 17 | |||||||||||||||||||||||||||||
| 18 | 0 | ▶ | sub new { | ||||||||||||||||||||||||||
|
Subroutine
new: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 19 | 0 | my $self = shift; | |||||||||||||||||||||||||||
| 20 | 0 | my $prev_period; | |||||||||||||||||||||||||||
| 21 | $self->SUPER::new( | ||||||||||||||||||||||||||||
| 22 | tabledata => 'Perl::CPAN::Release::Static', | ||||||||||||||||||||||||||||
| 23 | key => 'month', | ||||||||||||||||||||||||||||
| 24 | 0 | ▶ | calc_key => sub { | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=7 SCAR=40.3
| |||||||||||||||||||||||||||||
| 25 | 0 | my ($rowh, $aoa) = @_; | |||||||||||||||||||||||||||
| 26 | 0 | ▶ | $rowh->{date} =~ $re_period or die; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 27 | 0 | my $period = "$1-$2"; | |||||||||||||||||||||||||||
| 28 | 0 | ▶ | if ($prev_period && $prev_period ne $period) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$prev_period and $prev_period ne $period
MC/DC0%0/2
$prev_period and $prev_period ne $period
$prev_period
$prev_period ne $period
Truth table0%0/3
A and B
A= $prev_periodB= $prev_period ne $period
| |||||||||||||||||||||||||||||
| 29 | 0 | ▶ | $prev_period =~ $re_period or die; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 30 | 0 | my $dt = DateTime->new(year=>$1, month=>$2, day=>1); | |||||||||||||||||||||||||||
| 31 | 0 | $dt->add(months => 1); | |||||||||||||||||||||||||||
| 32 | 0 | ▶ | $period =~ $re_period or die; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 33 | 0 | my $dt_period = DateTime->new(year=>$1, month=>$2, day=>1); | |||||||||||||||||||||||||||
| 34 | 0 | ▶ | while (DateTime->compare($dt, $dt_period) < 0) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 35 | # close date gaps with rows of empty groups | ||||||||||||||||||||||||||||
| 36 | 0 | push @$aoa, [$dt->strftime("%Y-%m"), []]; | |||||||||||||||||||||||||||
| 37 | 0 | $dt->add(months => 1); | |||||||||||||||||||||||||||
| 38 | } | ||||||||||||||||||||||||||||
| 39 | } | ||||||||||||||||||||||||||||
| 40 | 0 | $prev_period = $period; | |||||||||||||||||||||||||||
| 41 | 0 | $period; | |||||||||||||||||||||||||||
| 42 | }, | ||||||||||||||||||||||||||||
| 43 | 0 | ); | |||||||||||||||||||||||||||
| 44 | } | ||||||||||||||||||||||||||||
| 45 | |||||||||||||||||||||||||||||
| 46 | 1 | our %STATS = ("num_rows",341,"num_columns",2); # STATS | |||||||||||||||||||||||||||
| 47 | |||||||||||||||||||||||||||||
| 48 | 1 | 1; | |||||||||||||||||||||||||||
| 49 | # ABSTRACT: CPAN releases (grouped monthly) | ||||||||||||||||||||||||||||
| 50 | |||||||||||||||||||||||||||||
| 51 | __END__ | ||||||||||||||||||||||||||||