=================================================================== RCS file: /cvs/todotxt/Text-Todo/lib/Text/Todo.pm,v retrieving revision 1.16 retrieving revision 1.21 diff -u -r1.16 -r1.21 --- todotxt/Text-Todo/lib/Text/Todo.pm 2010/01/12 19:40:52 1.16 +++ todotxt/Text-Todo/lib/Text/Todo.pm 2010/01/19 18:45:53 1.21 @@ -1,6 +1,6 @@ package Text::Todo; -# $AFresh1: Todo.pm,v 1.15 2010/01/11 19:52:06 andrew Exp $ +# $AFresh1: Todo.pm,v 1.20 2010/01/18 03:04:48 andrew Exp $ use warnings; use strict; @@ -14,10 +14,13 @@ { - my %path_of; - my %list_of; - my %loaded_of; + my @attr_refs = \( + my %path_of, + my %list_of, + my %loaded_of, + ); + sub new { my ( $class, $options ) = @_; @@ -203,7 +206,7 @@ if ($pri) { $pri = uc $pri; if ( $pri !~ /^[A-Z]$/xms ) { - croak "PRIORITY must a single letter from A to Z."; + croak 'PRIORITY must a single letter from A to Z.'; } @list = grep { defined $_->priority && $_->priority eq $pri } $self->list; @@ -260,19 +263,19 @@ } sub listproj { - my ( $self ) = @_; + my ($self) = @_; return $self->listtag('project'); } sub listcon { - my ( $self ) = @_; + my ($self) = @_; return $self->listtag('context'); } sub listtag { my ( $self, $tag ) = @_; my $ident = ident($self); - + my $accessor = $tag . 's'; my %available; @@ -284,7 +287,7 @@ my @tags = sort keys %available; - return wantarray ? @tags: \@tags; + return wantarray ? @tags : \@tags; } sub archive { @@ -382,6 +385,17 @@ croak "Invalid entry [$entry]!"; } + + sub DESTROY { + my ($self) = @_; + my $ident = ident $self; + + foreach my $attr_ref (@attr_refs) { + delete $attr_ref->{$ident}; + } + + return; + } } 1; # Magic true value required at end of module @@ -397,7 +411,7 @@ Since the $VERSION can't be automatically included, here is the RCS Id instead, you'll have to look up $VERSION. - $Id: Todo.pm,v 1.16 2010/01/12 19:40:52 andrew Exp $ + $Id: Todo.pm,v 1.21 2010/01/19 18:45:53 andrew Exp $ =head1 SYNOPSIS