The perl module MIME::Parser was not installed on my Ubuntu.
I found MIME::Parser on CPAN as part of MIME-tools
http://search.cpan.org/~doneill/MIME-tools-5.427/
For Ubuntu-users: install the libmime-perl package with synaptic (or whatever you prefer).
Now it works - thanks for sharing your code!
But what do you think about editing the outstring in the Tk-window - sometimes the mail subject does not reflect my thought.
I've replaced the code at the end of your script from
Code:
open OUT, ">>$outfile" or die "could not open file $outfile!";
unless (flock OUT, LOCK_EX | LOCK_NB) {
warn "File $outfile already locked; waiting...\n";
flock OUT, LOCK_EX or die "could not lock file $outfile\n";
}
print OUT "$outstring\n";
close OUT;
my $mw = MainWindow->new;
$mw->withdraw();
my $dialog = $mw->Dialog (-title => "Info",
-buttons => ["Ok"],
-text=>$outstring);
my $item = $dialog->Show();
exit 0;
to
Code:
my $mw = MainWindow->new;
$mw->geometry("+20+60");
$mw->Label(-text => 'Thought')->pack;
my $thought = $mw->Entry(-width => 120);
$thought->insert(0, $outstring);
$thought->pack;
$mw->Button(
-text => 'Save Thought',
-command => sub { save_thought($thought) }
)->pack;
$mw->Button(
-text => 'Quit',
-command => sub { exit }
)->pack;
MainLoop;
sub save_thought {
my $thought = shift;
$outstring = $thought->get;
$mw->Hide();
open OUT, ">>$outfile" or die "could not open file $outfile!";
unless (flock OUT, LOCK_EX | LOCK_NB) {
warn "File $outfile already locked; waiting...\n";
flock OUT, LOCK_EX or die "could not lock file $outfile\n";
}
print OUT "$outstring\n";
close OUT;
}
exit 0;
(extra indentation = my changes)
Hope you like it. Use at own risk.
