version 1.15, 2010/01/12 20:30:55 |
version 1.16, 2010/01/12 23:46:40 |
|
|
#!/usr/bin/perl |
#!/usr/bin/perl |
# $AFresh1: todo.pl,v 1.14 2010/01/11 19:52:06 andrew Exp $ |
# $AFresh1: todo.pl,v 1.15 2010/01/12 20:30:55 andrew Exp $ |
######################################################################## |
######################################################################## |
# todo.pl *** a perl version of todo.sh. Uses Text::Todo. |
# todo.pl *** a perl version of todo.sh. Uses Text::Todo. |
# |
# |
|
|
|
|
if ( exists $actions{$action} ) { |
if ( exists $actions{$action} ) { |
my $config = read_config($config_file); |
my $config = read_config($config_file); |
my $action = $actions{$action}->( $config, @ARGV ); |
my $result = $actions{$action}->( $config, @ARGV ); |
} |
} |
else { |
else { |
usage(); |
usage(); |
|
|
my @pri_list; |
my @pri_list; |
if ($pri) { |
if ($pri) { |
$pri = uc $pri; |
$pri = uc $pri; |
if ( $pri !~ /^[A-Z]$/xms ) { |
if ( $pri !~ /^[[:upper:]]$/xms ) { |
die "usage: todo.pl listpri PRIORITY\n", |
die "usage: todo.pl listpri PRIORITY\n", |
"note: PRIORITY must a single letter from A to Z.\n"; |
"note: PRIORITY must a single letter from A to Z.\n"; |
} |
} |
|
|
if ( !( $line && $line =~ /^\d+$/xms && $priority ) ) { |
if ( !( $line && $line =~ /^\d+$/xms && $priority ) ) { |
die "$error\n"; |
die "$error\n"; |
} |
} |
elsif ( $priority !~ /^[A-Z]$/xms ) { |
elsif ( $priority !~ /^[[:upper:]]$/xms ) { |
$error .= "\n" . 'note: PRIORITY must a single letter from A to Z.'; |
$error .= "\n" . 'note: PRIORITY must a single letter from A to Z.'; |
die "$error\n"; |
die "$error\n"; |
} |
} |