App-JobLog
view release on metacpan or search on metacpan
lib/App/JobLog/Log/Event.pm view on Meta::CPAN
}
sub end : lvalue {
$_[0]->{end};
}
sub cmp {
my ( $self, $other ) = @_;
my $comparison = $self->SUPER::cmp($other);
unless ($comparison) {
if ( $other->isa(__PACKAGE__) ) {
if ( $self->is_closed ) {
if ( $other->is_closed ) {
return DateTime->compare( $self->end, $other->end );
}
else {
return 1;
}
}
lib/App/JobLog/Vacation/Period.pm view on Meta::CPAN
sub repeats { $_[0]->{repeats} }
sub description : lvalue {
$_[0]->data->description;
}
sub clone {
my ($self) = @_;
my $clone = $self->SUPER::clone;
$clone->{type} = $self->{type};
$clone->{repeats} = $self->{repeats};
return $clone;
}
sub cmp {
my ( $self, $other ) = @_;
# when mixed with ordinary events
if ( ref $other eq 'App::JobLog::Log::Event' ) {
# treat as an ordinary event if fixed
return $self->SUPER::cmp($other) if $self->fixed;
# put after ordinary events
return 1;
}
if ( $self->monthly ) {
return -1 unless $other->monthly;
}
elsif ( $self->annual ) {
return 1 if $other->monthly;
return -1 unless $other->annual;
}
return $self->SUPER::cmp($other);
}
# some global variables for use in BNF regex
our ( @dates, $type, @tags, $description );
# log line parser
my $re = qr{
^ (?&ts) : (?&non_ts) $
(?(DEFINE)
(?<ts> (?&date) : (?&date) )
lib/App/JobLog/Vacation/Period.pm view on Meta::CPAN
$self->start->add( years => $delta );
$self->end->add( years => $delta );
}
if ( $self->monthly && $self->start->month != $start->month ) {
$self = $self->clone unless $cloned;
my $delta = $start->month - $self->start->month;
$self->start->add( months => $delta );
$self->end->add( months => $delta );
}
}
return $self->SUPER::overlap( $start, $end );
}
# tag part of summary
sub _tags {
my ($self) = @_;
return join ', ', @{ $self->tags };
}
# description part of summary
sub _description {
( run in 1.304 second using v1.01-cache-2.11-cpan-49f99fa48dc )