OurCal::Todo - a TODO class for OurCal


OurCal documentation Contained in the OurCal distribution.

Index


Code Index:

NAME

Top

OurCal::Todo - a TODO class for OurCal

METHODS

Top

new

Requires a description param and optionally a for and an id param.

id

The id of the TODO

description

The description of the TODO

for

Who the TODO is for

full_description

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;