9 print STDERR "$0: ", @_, "\n";
14 print STDERR "$0: ", @_, "\n";
22 print STDERR "$0: ", @_, "\n";
31 defined($kid) or retry("couldn't fork: $!");
37 print STDERR "$0: exec `", join(" ", @ARGV), "' failed: $!\n";
41 $body->print(\*OUT) or fail "print failed: $!", last;
42 close(OUT) or fail "close failed: $!";
43 waitpid($kid, 0) or fail "waitpid failed: $!";
44 $? and fail "program `", join(" ", @ARGV), "' exited with status $?";
49 foreach my $i ($e->parts()) {
50 msg($i->bodyhandle());
54 $SIG{__DIE__} = sub { retry "DEAD: ", @_, "!" };
56 @ARGV or retry "$0: no command given";
57 my $pp = MIME::Parser->new();
58 $pp->output_to_core(ALL);
59 $pp->extract_nested_messages(0);
60 my $top = $pp->parse(\*STDIN);
61 if ($top->effective_type =~ m'multipart/mixed'i) {
62 foreach my $i ($top->parts()) {
63 if ($i->effective_type =~ m'message/rfc822'i) {
64 msg($i->bodyhandle());
65 } elsif ($i->effective_type =~ m'multipart/digest'i) {
69 } elsif ($top->effective_type =~ m'multipart/digest'i) {
72 if (!$DONE) { bounce "no forwarded message or digest"; }