Skip to content

Commit

Permalink
Merge pull request #316 from mknos/mail-tmpfile
Browse files Browse the repository at this point in the history
mail: improve temp file selection
  • Loading branch information
briandfoy authored Nov 9, 2023
2 parents 2c61083 + d63536e commit 2c943ee
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions bin/mail
Original file line number Diff line number Diff line change
Expand Up @@ -417,7 +417,6 @@ sub load {
sub stuff {
my $self=shift;

print "In the stuff method\n";
push(@{$self->{messages}}, $_[0]);
$self->size(0);
}
Expand Down Expand Up @@ -625,6 +624,7 @@ EDLOOP: {
package main;

use English;
use File::Temp;
use Getopt::Std;
use vars qw($VERSION $ROWS $BUFFERL $box);

Expand Down Expand Up @@ -788,12 +788,13 @@ sub visual {
warn "Invalid message number: $msgno\n";
return;
}
my $tmbox=mailbox->new(file => "/tmp/ppt_mail$$");
my $tmp = File::Temp->new;
my $path = $tmp->filename;
my $tmbox = mailbox->new('file' => $path);
$tmbox->stuff($message);
$tmbox->file("/tmp/ppt_mail$$");
$tmbox->write;
system("$ENV{VISUAL} /tmp/ppt_mail$$");
$tmbox2=mailbox->new(file => "/tmp/ppt_mail$$"); # Hope this isn't a leak
system($ENV{'VISUAL'}, $path);
$tmbox2 = mailbox->new('file' => $path); # Hope this isn't a leak
print Dumper $tmbox2;
$tmbox2->load;
print Dumper $tmbox2;
Expand Down

0 comments on commit 2c943ee

Please sign in to comment.