Apache-CVS
view release on metacpan or search on metacpan
CVS/Revision.pm view on Meta::CPAN
bless ($self, $class);
return $self;
}
sub co_file {
my $self = shift;
$self->{co_file} = shift if scalar @_;
return $self->{co_file};
}
=item $revision->number()
Returns the number of the revision.
=cut
sub number {
my $self = shift;
$self->{number} = shift if scalar @_;
return $self->{number};
}
=item $revision->author()
Returns the author of the revision.
=cut
sub author {
my $self = shift;
$self->{author} = shift if scalar @_;
return $self->{author};
}
=item $revision->state()
Returns the state of the revision.
=cut
sub state {
my $self = shift;
$self->{state} = shift if scalar @_;
return $self->{state};
}
=item $revision->symbol()
Returns the symbol of the revision.
=cut
sub symbol {
my $self = shift;
$self->{symbol} = shift if scalar @_;
return $self->{symbol};
}
=item $revision->date()
Returns the date of the revision in Unix epoch time.
=cut
sub date {
my $self = shift;
$self->{date} = shift if scalar @_;
return $self->{date};
}
=item $revision->comment()
Returns the comments associated with this revision.
=cut
sub comment {
my $self = shift;
$self->{comment} = shift if scalar @_;
return $self->{comment};
}
sub time_diff {
my ($later, $earlier) = @_;
my $seconds_in_minute = 60;
my $seconds_in_hour = $seconds_in_minute * 60;
my $seconds_in_day = $seconds_in_hour * 24;
return undef unless $later >= $earlier;
my %time;
my $diff = $later - $earlier;
my $remainder = $diff % $seconds_in_day;
$time{days} = ($diff - $remainder) / $seconds_in_day;
$diff = $remainder;
$remainder = $diff % $seconds_in_hour;
$time{hours} = ($diff - $remainder) / $seconds_in_hour;
$diff = $remainder;
$remainder = $diff % $seconds_in_minute;
$time{minutes} = ($diff - $remainder) / $seconds_in_minute;
$time{seconds} = $remainder;
return \%time;
}
=item $revision->age()
Returns a hash that indicates the age of the revision. The keys of this hash
are: days, hours, minutes, and seconds.
=cut
sub age {
my $self = shift;
return time_diff(time, $self->{date});
}
( run in 1.384 second using v1.01-cache-2.11-cpan-5735350b133 )