=================================================================== RCS file: /cvs/todotxt/Text-Todo/bin/todo.pl,v retrieving revision 1.15 retrieving revision 1.22 diff -u -r1.15 -r1.22 --- todotxt/Text-Todo/bin/todo.pl 2010/01/12 20:30:55 1.15 +++ todotxt/Text-Todo/bin/todo.pl 2010/02/16 01:13:12 1.22 @@ -1,5 +1,5 @@ #!/usr/bin/perl -# $AFresh1: todo.pl,v 1.14 2010/01/11 19:52:06 andrew Exp $ +# $AFresh1: todo.pl,v 1.21 2010/02/03 18:14:01 andrew Exp $ ######################################################################## # todo.pl *** a perl version of todo.sh. Uses Text::Todo. # @@ -13,12 +13,10 @@ use strict; use warnings; -use Data::Dumper; - use Getopt::Std; use Text::Todo; -use version; our $VERSION = qv('0.0.1'); +use version; our $VERSION = qv('0.1.2'); # option defaults my $config_file = $ENV{HOME} . '/todo.cfg'; @@ -96,7 +94,7 @@ if ( exists $actions{$action} ) { my $config = read_config($config_file); - my $action = $actions{$action}->( $config, @ARGV ); + my $result = $actions{$action}->( $config, @ARGV ); } else { usage(); @@ -111,7 +109,7 @@ my $entry = join q{ }, @entry; my $todo = Text::Todo->new($config); - if ( $todo->add($entry) ) { + if ( $todo->add($entry) && $todo->save ) { my @list = $todo->list; my $lines = scalar @list; @@ -295,7 +293,7 @@ my @pri_list; if ($pri) { $pri = uc $pri; - if ( $pri !~ /^[A-Z]$/xms ) { + if ( $pri !~ /^[[:upper:]]$/xms ) { die "usage: todo.pl listpri PRIORITY\n", "note: PRIORITY must a single letter from A to Z.\n"; } @@ -346,7 +344,7 @@ if ( !( $line && $line =~ /^\d+$/xms && $priority ) ) { die "$error\n"; } - elsif ( $priority !~ /^[A-Z]$/xms ) { + elsif ( $priority !~ /^[[:upper:]]$/xms ) { $error .= "\n" . 'note: PRIORITY must a single letter from A to Z.'; die "$error\n"; } @@ -474,9 +472,9 @@ if (s/^\s*export\s+//xms) { my ( $key, $value ) = /^([^=]+)\s*=\s*"?(.*?)"?\s*$/xms; if ($key) { - foreach my $k ( keys %config ) { - $value =~ s/\$\Q$k\E/$config{$k}/gxms; - $value =~ s/\${\Q$k\E}/$config{$k}/gxms; + foreach my $k ( keys %{ $config } ) { + $value =~ s/\$\Q$k\E/$config->{$k}/gxms; + $value =~ s/\${\Q$k\E}/$config->{$k}/gxms; } foreach my $k ( keys %ENV ) { $value =~ s/\$\Q$k\E/$ENV{$k}/gxms; @@ -504,7 +502,7 @@ Since the $VERSION can't be automatically included, here is the RCS Id instead, you'll have to look up $VERSION. - $Id: todo.pl,v 1.15 2010/01/12 20:30:55 andrew Exp $ + $Id: todo.pl,v 1.22 2010/02/16 01:13:12 andrew Exp $ =head1 SYNOPSIS