#!/usr/bin/perl

use strict;
use warnings;

use Parp::Folders qw(append_to_folder);
use Mail::Internet;
use Parp::Mail;
use POSIX;

my $mail  = Mail::Internet->new([ <STDIN> ]);
my $mailf = Parp::Mail->new($mail);
print "pid $$\n";
$| = 1;
while (1) {
  my $tmpfile = "/tmp/file" . int rand(20);
  my $old = -s $tmpfile || 0;
  print "$tmpfile ... ";
  append_to_folder($tmpfile, $mailf);
  print "done\n";
  die "$tmpfile?!" unless -s $tmpfile > $old;
  sleep 2;
}
