| OurCal documentation | Contained in the OurCal distribution. |
OurCal::Todo - a TODO class for OurCal
Requires a description param and optionally a for and an id param.
The id of the TODO
The description of the TODO
Who the TODO is for
The Description plus the for if it's present
| OurCal documentation | Contained in the OurCal distribution. |
package OurCal::Todo; use strict;
sub new { my ($class, %todo) = @_; return bless \%todo, $class; }
sub id { my $self = shift; return $self->{id}; }
sub description { my $self = shift; return $self->_trim($self->{description}); }
sub for { my $self = shift; return $self->{for}; }
sub full_description { my ($self) = @_; my $for = $self->{for}; my $description; if (defined $for) { $description = sprintf "(%s) %s", $for, $self->description; } else { $description = sprintf "%s", $self->description; } return $description; } sub _trim { my($self, $text) = @_; $text =~ s/^\s*(.+=?)\$/$1/; return $text; } 1;