| 1 | package TUI::Gadgets::CalendarView; | ||||||||||||||||||||||||||||||||||
| 2 | # ABSTRACT: view showing a month calendar | ||||||||||||||||||||||||||||||||||
| 3 | |||||||||||||||||||||||||||||||||||
| 4 | 5 | ▶ | use 5.010; | ||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||
| 5 | 5 | ▶ | use strict; | ||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||
| 6 | 5 | ▶ | use warnings; | ||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||
| 7 | |||||||||||||||||||||||||||||||||||
| 8 | 5 | our $VERSION = '2.000003'; | |||||||||||||||||||||||||||||||||
| 9 | 5 | $VERSION =~ tr/_//d; | |||||||||||||||||||||||||||||||||
| 10 | 5 | our $AUTHORITY = 'cpan:BRICKPOOL'; | |||||||||||||||||||||||||||||||||
| 11 | |||||||||||||||||||||||||||||||||||
| 12 | 5 | ▶ | use Exporter 'import'; | ||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||
| 13 | 5 | our @EXPORT = qw( | |||||||||||||||||||||||||||||||||
| 14 | TCalendarView | ||||||||||||||||||||||||||||||||||
| 15 | new_TCalendarView | ||||||||||||||||||||||||||||||||||
| 16 | ); | ||||||||||||||||||||||||||||||||||
| 17 | |||||||||||||||||||||||||||||||||||
| 18 | 5 | ▶ | use TUI::toolkit; | ||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||
| 19 | 5 | ▶ | use TUI::toolkit::Types qw( | ||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||
| 20 | :is | ||||||||||||||||||||||||||||||||||
| 21 | :types | ||||||||||||||||||||||||||||||||||
| 22 | 5 | ); | |||||||||||||||||||||||||||||||||
| 23 | |||||||||||||||||||||||||||||||||||
| 24 | 5 | ▶ | use TUI::Drivers::Const qw( | ||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||
| 25 | :evXXXX | ||||||||||||||||||||||||||||||||||
| 26 | kbDown | ||||||||||||||||||||||||||||||||||
| 27 | kbUp | ||||||||||||||||||||||||||||||||||
| 28 | 5 | ); | |||||||||||||||||||||||||||||||||
| 29 | 5 | ▶ | use TUI::Drivers::Event; | ||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||
| 30 | 5 | ▶ | use TUI::Objects::Rect; | ||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||
| 31 | 5 | ▶ | use TUI::Views::Const qw( | ||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||
| 32 | ofSelectable | ||||||||||||||||||||||||||||||||||
| 33 | sfSelected | ||||||||||||||||||||||||||||||||||
| 34 | 5 | ); | |||||||||||||||||||||||||||||||||
| 35 | 5 | ▶ | use TUI::Views::DrawBuffer; | ||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||
| 36 | 5 | ▶ | use TUI::Views::View; | ||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||
| 37 | |||||||||||||||||||||||||||||||||||
| 38 | sub TCalendarView() { __PACKAGE__ } | ||||||||||||||||||||||||||||||||||
| 39 | sub name() { 'TCalendarView' } | ||||||||||||||||||||||||||||||||||
| 40 | 0 | ▶ | sub new_TCalendarView { __PACKAGE__->from(@_) } | ||||||||||||||||||||||||||||||||
|
Subroutine
new_TCalendarView: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||
| 41 | |||||||||||||||||||||||||||||||||||
| 42 | 5 | extends TView; | |||||||||||||||||||||||||||||||||
| 43 | |||||||||||||||||||||||||||||||||||
| 44 | 5 | my @monthNames = ( | |||||||||||||||||||||||||||||||||
| 45 | '', | ||||||||||||||||||||||||||||||||||
| 46 | qw( | ||||||||||||||||||||||||||||||||||
| 47 | January February March April May June | ||||||||||||||||||||||||||||||||||
| 48 | July August September October November December | ||||||||||||||||||||||||||||||||||
| 49 | ), | ||||||||||||||||||||||||||||||||||
| 50 | ); | ||||||||||||||||||||||||||||||||||
| 51 | |||||||||||||||||||||||||||||||||||
| 52 | 5 | my @daysInMonth = ( 0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 ); | |||||||||||||||||||||||||||||||||
| 53 | |||||||||||||||||||||||||||||||||||
| 54 | # private attributes | ||||||||||||||||||||||||||||||||||
| 55 | 5 | has month => ( is => 'bare' ); | |||||||||||||||||||||||||||||||||
| 56 | 5 | has year => ( is => 'bare' ); | |||||||||||||||||||||||||||||||||
| 57 | 5 | has curDay => ( is => 'bare' ); | |||||||||||||||||||||||||||||||||
| 58 | 5 | has curMonth => ( is => 'bare' ); | |||||||||||||||||||||||||||||||||
| 59 | 5 | has curYear => ( is => 'bare' ); | |||||||||||||||||||||||||||||||||
| 60 | |||||||||||||||||||||||||||||||||||
| 61 | # private methods (anonymous subs, as in TEventViewer) | ||||||||||||||||||||||||||||||||||
| 62 | 5 | my ( $dayOfWeek, $nextMonth, $prevMonth ); | |||||||||||||||||||||||||||||||||
| 63 | |||||||||||||||||||||||||||||||||||
| 64 | 0 | ▶ | sub BUILD { # void (\%args) | ||||||||||||||||||||||||||||||||
|
Subroutine
BUILD: not called CC=3 SCAR=24.8
Pod
documented
| |||||||||||||||||||||||||||||||||||
| 65 | 0 | my ( $self, $args ) = @_; | |||||||||||||||||||||||||||||||||
| 66 | 0 | ▶ | assert ( @_ == 2 ); | ||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||
| 67 | 0 | ▶ | assert ( is_Object $self ); | ||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||
| 68 | |||||||||||||||||||||||||||||||||||
| 69 | 0 | $self->{options} |= ofSelectable; | |||||||||||||||||||||||||||||||||
| 70 | 0 | $self->{eventMask} |= evMouseAuto; | |||||||||||||||||||||||||||||||||
| 71 | |||||||||||||||||||||||||||||||||||
| 72 | 0 | my ( $day, $mon, $year ) = ( localtime )[ 3, 4, 5 ]; | |||||||||||||||||||||||||||||||||
| 73 | 0 | $self->{year} = $self->{curYear} = $year + 1900; | |||||||||||||||||||||||||||||||||
| 74 | 0 | $self->{month} = $self->{curMonth} = $mon + 1; | |||||||||||||||||||||||||||||||||
| 75 | 0 | $self->{curDay} = $day; | |||||||||||||||||||||||||||||||||
| 76 | |||||||||||||||||||||||||||||||||||
| 77 | 0 | $self->drawView(); | |||||||||||||||||||||||||||||||||
| 78 | 0 | return; | |||||||||||||||||||||||||||||||||
| 79 | } | ||||||||||||||||||||||||||||||||||
| 80 | |||||||||||||||||||||||||||||||||||
| 81 | 0 | ▶ | sub handleEvent { # void ($event) | ||||||||||||||||||||||||||||||||
|
Subroutine
handleEvent: not called CC=13 SCAR=52.0
Pod
documented
| |||||||||||||||||||||||||||||||||||
| 82 | 0 | state $sig = signature( | |||||||||||||||||||||||||||||||||
| 83 | method => Object, | ||||||||||||||||||||||||||||||||||
| 84 | pos => [Object], | ||||||||||||||||||||||||||||||||||
| 85 | ); | ||||||||||||||||||||||||||||||||||
| 86 | 0 | my ( $self, $event ) = $sig->( @_ ); | |||||||||||||||||||||||||||||||||
| 87 | 0 | $self->SUPER::handleEvent( $event ); | |||||||||||||||||||||||||||||||||
| 88 | |||||||||||||||||||||||||||||||||||
| 89 | 0 | ▶ | if ( $self->{state} & sfSelected ) { | ||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||
| 90 | 0 | SWITCH: for ( $event->{what} ) { | |||||||||||||||||||||||||||||||||
| 91 | 0 | ▶ | ( evMouse & $_ ) and do { | ||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||
| 92 | 0 | my $point = $self->makeLocal( $event->{mouse}{where} ); | |||||||||||||||||||||||||||||||||
| 93 | 0 | ▶ | ( $point->{x} == 15 && $point->{y} == 0 ) and do { | ||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$point->{"x"} == 15 and $point->{"y"} == 0
MC/DC0%0/2
$point->{"x"} == 15 and $point->{"y"} == 0
$point->{"x"} == 15
$point->{"y"} == 0
Truth table0%0/3
A and B
A= $point->{"x"} == 15B= $point->{"y"} == 0
| |||||||||||||||||||||||||||||||||||
| 94 | 0 | $nextMonth->( $self ); | |||||||||||||||||||||||||||||||||
| 95 | 0 | $self->drawView(); | |||||||||||||||||||||||||||||||||
| 96 | 0 | last; | |||||||||||||||||||||||||||||||||
| 97 | }; | ||||||||||||||||||||||||||||||||||
| 98 | 0 | ▶ | ( $point->{x} == 18 && $point->{y} == 0 ) and do { | ||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$point->{"x"} == 18 and $point->{"y"} == 0
MC/DC0%0/2
$point->{"x"} == 18 and $point->{"y"} == 0
$point->{"x"} == 18
$point->{"y"} == 0
Truth table0%0/3
A and B
A= $point->{"x"} == 18B= $point->{"y"} == 0
| |||||||||||||||||||||||||||||||||||
| 99 | 0 | $prevMonth->( $self ); | |||||||||||||||||||||||||||||||||
| 100 | 0 | $self->drawView(); | |||||||||||||||||||||||||||||||||
| 101 | 0 | last; | |||||||||||||||||||||||||||||||||
| 102 | }; | ||||||||||||||||||||||||||||||||||
| 103 | 0 | last; | |||||||||||||||||||||||||||||||||
| 104 | }; | ||||||||||||||||||||||||||||||||||
| 105 | |||||||||||||||||||||||||||||||||||
| 106 | 0 | ▶ | evKeyboard == $_ and do { | ||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||
| 107 | 0 | my $keyCode = $event->{keyDown}{keyCode}; | |||||||||||||||||||||||||||||||||
| 108 | 0 | my $char = $keyCode & 0xff; | |||||||||||||||||||||||||||||||||
| 109 | 0 | ▶ | ( $char == ord( '+' ) || $keyCode == kbDown ) and $nextMonth->( $self ); | ||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$char == 43 or $keyCode == 20480
MC/DC0%0/2
$char == 43 or $keyCode == 20480
$char == 43
$keyCode == 20480
Truth table0%0/3
A or B
A= $char == 43B= $keyCode == 20480
| |||||||||||||||||||||||||||||||||||
| 110 | 0 | ▶ | ( $char == ord( '-' ) || $keyCode == kbUp ) and $prevMonth->( $self ); | ||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$char == 45 or $keyCode == 18432
MC/DC0%0/2
$char == 45 or $keyCode == 18432
$char == 45
$keyCode == 18432
Truth table0%0/3
A or B
A= $char == 45B= $keyCode == 18432
| |||||||||||||||||||||||||||||||||||
| 111 | 0 | $self->drawView(); | |||||||||||||||||||||||||||||||||
| 112 | 0 | last; | |||||||||||||||||||||||||||||||||
| 113 | }; | ||||||||||||||||||||||||||||||||||
| 114 | } #/ SWITCH: for ( $event->{what} ) | ||||||||||||||||||||||||||||||||||
| 115 | } | ||||||||||||||||||||||||||||||||||
| 116 | 0 | return; | |||||||||||||||||||||||||||||||||
| 117 | } | ||||||||||||||||||||||||||||||||||
| 118 | |||||||||||||||||||||||||||||||||||
| 119 | 0 | ▶ | sub draw { # void () | ||||||||||||||||||||||||||||||||
|
Subroutine
draw: not called CC=10 SCAR=47.0
Pod
documented
| |||||||||||||||||||||||||||||||||||
| 120 | 0 | state $sig = signature( | |||||||||||||||||||||||||||||||||
| 121 | method => Object, | ||||||||||||||||||||||||||||||||||
| 122 | pos => [], | ||||||||||||||||||||||||||||||||||
| 123 | ); | ||||||||||||||||||||||||||||||||||
| 124 | 0 | my ( $self ) = $sig->( @_ ); | |||||||||||||||||||||||||||||||||
| 125 | |||||||||||||||||||||||||||||||||||
| 126 | 0 | my $color = $self->getColor( 6 ); | |||||||||||||||||||||||||||||||||
| 127 | 0 | my $boldColor = $self->getColor( 7 ); | |||||||||||||||||||||||||||||||||
| 128 | 0 | my $month = $self->{month}; | |||||||||||||||||||||||||||||||||
| 129 | 0 | my $year = $self->{year}; | |||||||||||||||||||||||||||||||||
| 130 | 0 | my $buf = TDrawBuffer->new(); | |||||||||||||||||||||||||||||||||
| 131 | |||||||||||||||||||||||||||||||||||
| 132 | 0 | my $current = 1 - $dayOfWeek->( 1, $month, $year ); | |||||||||||||||||||||||||||||||||
| 133 | 0 | ▶ | my $days = $daysInMonth[ $month ] | ||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$year % 4 == 0 and $month == 2
MC/DC0%0/2
$year % 4 == 0 and $month == 2
$year % 4 == 0
$month == 2
Truth table0%0/3
A and B
A= $year % 4 == 0B= $month == 2
| |||||||||||||||||||||||||||||||||||
| 134 | + ( ( $year % 4 == 0 && $month == 2 ) ? 1 : 0 ); | ||||||||||||||||||||||||||||||||||
| 135 | |||||||||||||||||||||||||||||||||||
| 136 | 0 | $buf->moveChar( 0, ' ', $color, 22 ); | |||||||||||||||||||||||||||||||||
| 137 | 0 | $buf->moveStr( 0, | |||||||||||||||||||||||||||||||||
| 138 | sprintf( '%9s %4d %s %s ', | ||||||||||||||||||||||||||||||||||
| 139 | $monthNames[ $month ], $year, chr( 30 ), chr( 31 ) ), | ||||||||||||||||||||||||||||||||||
| 140 | $color ); | ||||||||||||||||||||||||||||||||||
| 141 | 0 | $self->writeLine( 0, 0, 22, 1, $buf ); | |||||||||||||||||||||||||||||||||
| 142 | |||||||||||||||||||||||||||||||||||
| 143 | 0 | $buf->moveChar( 0, ' ', $color, 22 ); | |||||||||||||||||||||||||||||||||
| 144 | 0 | $buf->moveStr( 0, 'Su Mo Tu We Th Fr Sa', $color ); | |||||||||||||||||||||||||||||||||
| 145 | 0 | $self->writeLine( 0, 1, 22, 1, $buf ); | |||||||||||||||||||||||||||||||||
| 146 | |||||||||||||||||||||||||||||||||||
| 147 | 0 | for my $i ( 1 .. 6 ) { | |||||||||||||||||||||||||||||||||
| 148 | 0 | $buf->moveChar( 0, ' ', $color, 22 ); | |||||||||||||||||||||||||||||||||
| 149 | 0 | for my $j ( 0 .. 6 ) { | |||||||||||||||||||||||||||||||||
| 150 | 0 | ▶ | if ( $current < 1 || $current > $days ) { | ||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$current < 1 or $current > $days
MC/DC0%0/2
$current < 1 or $current > $days
$current < 1
$current > $days
Truth table0%0/3
A or B
A= $current < 1B= $current > $days
| |||||||||||||||||||||||||||||||||||
| 151 | 0 | $buf->moveStr( $j * 3, ' ', $color ); | |||||||||||||||||||||||||||||||||
| 152 | } | ||||||||||||||||||||||||||||||||||
| 153 | else { | ||||||||||||||||||||||||||||||||||
| 154 | my $isToday = $year == $self->{curYear} | ||||||||||||||||||||||||||||||||||
| 155 | && $month == $self->{curMonth} | ||||||||||||||||||||||||||||||||||
| 156 | 0 | ▶ | && $current == $self->{curDay}; | ||||||||||||||||||||||||||||||||
|
Condition0%0/6
$year == $self->{'curYear'} && $month == $self->{'curMonth'} && $current == $self->{'curDay'}
$year == $self->{"curYear"} and $month == $self->{"curMonth"}
MC/DC0%0/3
$year == $self->{'curYear'} && $month == $self->{'curMonth'} && $current == $self->{'curDay'}
$year == $self->{"curYear"}
$month == $self->{"curMonth"}
$current == $self->{'curDay'}
Truth table0%0/4
A and B && C
A= $year == $self->{"curYear"}B= $month == $self->{"curMonth"}C= $current == $self->{'curDay'}
| |||||||||||||||||||||||||||||||||||
| 157 | 0 | ▶ | $buf->moveStr( $j * 3, sprintf( '%2d', $current ), | ||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||
| 158 | $isToday ? $boldColor : $color ); | ||||||||||||||||||||||||||||||||||
| 159 | } | ||||||||||||||||||||||||||||||||||
| 160 | 0 | $current++; | |||||||||||||||||||||||||||||||||
| 161 | } | ||||||||||||||||||||||||||||||||||
| 162 | 0 | $self->writeLine( 0, $i + 1, 22, 1, $buf ); | |||||||||||||||||||||||||||||||||
| 163 | } | ||||||||||||||||||||||||||||||||||
| 164 | 0 | return; | |||||||||||||||||||||||||||||||||
| 165 | } | ||||||||||||||||||||||||||||||||||
| 166 | |||||||||||||||||||||||||||||||||||
| 167 | 0 | ▶ | $dayOfWeek = sub { # $dw ($day, $month, $year) | ||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=6 SCAR=37.4
| |||||||||||||||||||||||||||||||||||
| 168 | 0 | my ( $day, $month, $year ) = @_; | |||||||||||||||||||||||||||||||||
| 169 | 0 | ▶ | assert ( @_ == 3 ); | ||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||
| 170 | 0 | ▶ | assert ( is_Int $day ); | ||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||
| 171 | 0 | ▶ | assert ( is_Int $month ); | ||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||
| 172 | 0 | ▶ | assert ( is_Int $year ); | ||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||
| 173 | 0 | ▶ | if ( $month < 3 ) { | ||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||
| 174 | 0 | $month += 10; | |||||||||||||||||||||||||||||||||
| 175 | 0 | --$year; | |||||||||||||||||||||||||||||||||
| 176 | } | ||||||||||||||||||||||||||||||||||
| 177 | else { | ||||||||||||||||||||||||||||||||||
| 178 | 0 | $month -= 2; | |||||||||||||||||||||||||||||||||
| 179 | } | ||||||||||||||||||||||||||||||||||
| 180 | 0 | my $century = int( $year / 100 ); | |||||||||||||||||||||||||||||||||
| 181 | 0 | my $yr = $year % 100; | |||||||||||||||||||||||||||||||||
| 182 | 0 | return ( int( ( 26 * $month - 2 ) / 10 ) + $day + $yr | |||||||||||||||||||||||||||||||||
| 183 | + int( $yr / 4 ) + int( $century / 4 ) - 2 * $century ) % 7; | ||||||||||||||||||||||||||||||||||
| 184 | 5 | }; | |||||||||||||||||||||||||||||||||
| 185 | |||||||||||||||||||||||||||||||||||
| 186 | 0 | ▶ | $nextMonth = sub { # void () | ||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=4 SCAR=30.0
| |||||||||||||||||||||||||||||||||||
| 187 | 0 | my ( $self ) = @_; | |||||||||||||||||||||||||||||||||
| 188 | 0 | ▶ | assert ( @_ == 1 ); | ||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||
| 189 | 0 | ▶ | assert ( is_Object $self ); | ||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||
| 190 | 0 | ▶ | if ( ++$self->{month} > 12 ) { | ||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||
| 191 | 0 | ++$self->{year}; | |||||||||||||||||||||||||||||||||
| 192 | 0 | $self->{month} = 1; | |||||||||||||||||||||||||||||||||
| 193 | } | ||||||||||||||||||||||||||||||||||
| 194 | 0 | return; | |||||||||||||||||||||||||||||||||
| 195 | 5 | }; | |||||||||||||||||||||||||||||||||
| 196 | |||||||||||||||||||||||||||||||||||
| 197 | 0 | ▶ | $prevMonth = sub { # void () | ||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=4 SCAR=30.0
| |||||||||||||||||||||||||||||||||||
| 198 | 0 | my ( $self ) = @_; | |||||||||||||||||||||||||||||||||
| 199 | 0 | ▶ | assert ( @_ == 1 ); | ||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||
| 200 | 0 | ▶ | assert ( is_Object $self ); | ||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||
| 201 | 0 | ▶ | if ( --$self->{month} < 1 ) { | ||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||
| 202 | 0 | --$self->{year}; | |||||||||||||||||||||||||||||||||
| 203 | 0 | $self->{month} = 12; | |||||||||||||||||||||||||||||||||
| 204 | } | ||||||||||||||||||||||||||||||||||
| 205 | 0 | return; | |||||||||||||||||||||||||||||||||
| 206 | 5 | }; | |||||||||||||||||||||||||||||||||
| 207 | |||||||||||||||||||||||||||||||||||
| 208 | 0 | ▶ | sub write :method { # void ($os) | ||||||||||||||||||||||||||||||||
|
Subroutine
write: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||
| 209 | 0 | state $sig = signature( | |||||||||||||||||||||||||||||||||
| 210 | method => Object, | ||||||||||||||||||||||||||||||||||
| 211 | pos => [Object], | ||||||||||||||||||||||||||||||||||
| 212 | ); | ||||||||||||||||||||||||||||||||||
| 213 | 0 | my ( $self, $os ) = $sig->( @_ ); | |||||||||||||||||||||||||||||||||
| 214 | 0 | $self->SUPER::write( $os ); | |||||||||||||||||||||||||||||||||
| 215 | $os->put( | ||||||||||||||||||||||||||||||||||
| 216 | $self->{month}, | ||||||||||||||||||||||||||||||||||
| 217 | $self->{year}, | ||||||||||||||||||||||||||||||||||
| 218 | $self->{curDay}, | ||||||||||||||||||||||||||||||||||
| 219 | $self->{curMonth}, | ||||||||||||||||||||||||||||||||||
| 220 | $self->{curYear}, | ||||||||||||||||||||||||||||||||||
| 221 | 0 | ); | |||||||||||||||||||||||||||||||||
| 222 | 0 | return; | |||||||||||||||||||||||||||||||||
| 223 | } | ||||||||||||||||||||||||||||||||||
| 224 | |||||||||||||||||||||||||||||||||||
| 225 | 0 | ▶ | sub read :method { # $self ($is) | ||||||||||||||||||||||||||||||||
|
Subroutine
read: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||
| 226 | 0 | state $sig = signature( | |||||||||||||||||||||||||||||||||
| 227 | method => Object, | ||||||||||||||||||||||||||||||||||
| 228 | pos => [Object], | ||||||||||||||||||||||||||||||||||
| 229 | ); | ||||||||||||||||||||||||||||||||||
| 230 | 0 | my ( $self, $is ) = $sig->( @_ ); | |||||||||||||||||||||||||||||||||
| 231 | 0 | $self->SUPER::read( $is ); | |||||||||||||||||||||||||||||||||
| 232 | 0 | $self->{month} = $is->get(); | |||||||||||||||||||||||||||||||||
| 233 | 0 | $self->{year} = $is->get(); | |||||||||||||||||||||||||||||||||
| 234 | 0 | $self->{curDay} = $is->get(); | |||||||||||||||||||||||||||||||||
| 235 | 0 | $self->{curMonth} = $is->get(); | |||||||||||||||||||||||||||||||||
| 236 | 0 | $self->{curYear} = $is->get(); | |||||||||||||||||||||||||||||||||
| 237 | 0 | return $self; | |||||||||||||||||||||||||||||||||
| 238 | } | ||||||||||||||||||||||||||||||||||
| 239 | |||||||||||||||||||||||||||||||||||
| 240 | 5 | 1 | |||||||||||||||||||||||||||||||||
| 241 | |||||||||||||||||||||||||||||||||||
| 242 | __END__ | ||||||||||||||||||||||||||||||||||