App-JobLog
view release on metacpan - search on metacpan
view release on metacpan or search on metacpan
lib/App/JobLog/Log/Day.pm view on Meta::CPAN
package App::JobLog::Log::Day;
$App::JobLog::Log::Day::VERSION = '1.042';
# ABSTRACT: collects events and vacation in a complete day
use Modern::Perl;
use App::JobLog::Config qw(
day_length
is_workday
precision
);
use Carp qw(carp);
use Text::Wrap;
use App::JobLog::Log::Format qw(
duration
wrap
);
use constant WORK_SECONDS => 60 * 60 * day_length;
sub new {
my ( $class, %opts ) = @_;
$class = ref $class || $class;
bless { events => [], vacation => [], synopses => [], %opts }, $class;
}
sub concerns_notes { $_[0]->{notes} }
sub start { $_[0]->{start} }
sub end { $_[0]->{end} }
sub skip_flex { $_[0]->{skip_flex} }
sub time_remaining {
my ($self) = @_;
my $t = 0;
$t -= $_->duration for @{ $self->events }, @{ $self->vacation };
$t += WORK_SECONDS if is_workday $self->start;
return $t;
}
sub events { $_[0]->{events} }
sub last_event { ( $_[0]->events || [] )->[-1] }
sub vacation { $_[0]->{vacation} }
sub synopses { $_[0]->{synopses} }
sub is_empty {
my ($self) = @_;
return !( @{ $self->events } || @{ $self->vacation } );
}
sub show_date { !$_[0]->no_date }
view all matches for this distributionview release on metacpan - search on metacpan
( run in 1.278 second using v1.00-cache-2.02-grep-82fe00e-cpan-cec75d87357c )