maildrop_todo.pl

This is a script that I wrote with intentions of using it, specifically getting my wife to use it ;) to make sure that my 'Honey Do' list is updated. [download here](http://files.technomage.net/maildrop_todo.pl.txt) There are probably some security issues that I need to deal with yet, use at your own risk!
#!/usr/bin/perl
 
# $Id: maildrop_todo.pl,v 1.1 2010/10/27 10:50:42 mharlow Exp mharlow $
 
# by Matt Okeson-harlow
# get todo.sh from http://ginatrapani.github.com/todo.txt-cli/
 
# add to ~/.mailfilter
# xfilter "$HOME/bin/maildrop_todo.pl -string my-todo"
 
 
use strict;
use warnings;
use Carp;
use English qw( -no_match_vars );
use Getopt::Long;
 
my $todo_file = qq{$ENV{HOME}/Dropbox/GTD/todo.txt};
my $todo_string = q{todo_string};
 
my $options_ok = GetOptions(
    'string=s' => \$todo_string,
    'file=s'   => \$todo_file,
);
 
my $ifh = \*STDIN;
my $ofh = \*STDOUT;
 
while ( my $line = <$ifh> ) {
    print {$ofh} $line or croak qq{ERROR: $OS_ERROR};
    if ( $line =~ m{\A$todo_string:\s*(.*)\n*\z}xms ) {
        my $todo = $1;
        open my $todo_fh, '>>', $todo_file or croak qq{ERROR: $OS_ERROR};
        print {$todo_fh} $todo or croak qq{ERROR: $OS_ERROR};
        close $todo_fh or croak qq{ERROR: $OS_ERROR};
    }
}
 
exit 0;