version 1.6, 2009/07/13 18:50:37 |
version 1.7, 2009/07/13 19:05:50 |
|
|
package Text::Todo::Entry; |
package Text::Todo::Entry; |
|
|
# $RedRiver: Entry.pm,v 1.5 2009/07/11 16:02:18 andrew Exp $ |
# $RedRiver: Entry.pm,v 1.6 2009/07/13 17:50:37 andrew Exp $ |
|
|
use warnings; |
use warnings; |
use strict; |
use strict; |
|
|
|
|
my %tags_of; |
my %tags_of; |
my %priority_of; |
my %priority_of; |
|
my %completion_status_of; |
|
|
my %tags = ( |
my %tags = ( |
context => q{@}, |
context => q{@}, |
|
|
$tags_of{$ident}{$tag} = { map { $_ => q{} } |
$tags_of{$ident}{$tag} = { map { $_ => q{} } |
$text =~ / (?:^|\s) $symbol (\S+)/gxms }; |
$text =~ / (?:^|\s) $symbol (\S+)/gxms }; |
} |
} |
( $priority_of{$ident} ) = $text =~ /^ \s* \( ([A-Z]) \)/ixms; |
( $completion_status_of{$ident} ) = $text =~ /^ \s*(x) /ixms; |
|
( $priority_of{$ident} ) |
|
= $text =~ /^ (?:\s*x)? \s* \( ([A-Z]) \)/ixms; |
|
|
return 1; |
return 1; |
} |
} |
|
|
return $priority_of{$ident}; |
return $priority_of{$ident}; |
} |
} |
|
|
|
sub completed { |
|
my ($self) = @_; |
|
my $ident = ident($self); |
|
|
|
return $completion_status_of{$ident}; |
|
} |
|
|
sub change { |
sub change { |
my ( $self, $text ) = @_; |
my ( $self, $text ) = @_; |
return $self->_update_entry($text); |
return $self->_update_entry($text); |
|
|
return $self->change( join q{ }, $self->text, $addition ); |
return $self->change( join q{ }, $self->text, $addition ); |
} |
} |
|
|
} |
sub complete { |
|
my ($self) = @_; |
|
|
|
if ( $self->completed ) { |
|
return 1; |
|
} |
|
|
|
return $self->change( join q{ }, 'x', $self->text ); |
|
} |
|
|
|
} |
1; # Magic true value required at end of module |
1; # Magic true value required at end of module |
__END__ |
__END__ |
|
|
|
|
=head2 prepend |
=head2 prepend |
|
|
=head2 append |
=head2 append |
|
|
|
=head2 complete |
|
|
|
=head2 completed |
|
|
|
|
=head1 DIAGNOSTICS |
=head1 DIAGNOSTICS |