| 1 |
#!perl |
| 2 |
use strict; |
| 3 |
use warnings; |
| 4 |
|
| 5 |
use File::Spec; |
| 6 |
use File::Temp; |
| 7 |
|
| 8 |
my $dir = $ENV{EMAIL_SENDER_TRANSPORT_SENDMAIL_TEST_LOGDIR} |
| 9 |
|| File::Temp::tempdir( CLEANUP => 1 ); |
| 10 |
|
| 11 |
my $logfile = File::Spec->catfile($dir, 'sendmail.log'); |
| 12 |
|
| 13 |
my $input = join '', <STDIN>; |
| 14 |
|
| 15 |
open my $fh, '>', $logfile |
| 16 |
or die "Cannot write to logfile $logfile: $!"; |
| 17 |
|
| 18 |
print $fh "CLI args: @ARGV\n"; |
| 19 |
if (defined $input && length $input) { |
| 20 |
print $fh "Executed with input on STDIN\n$input"; |
| 21 |
} else { |
| 22 |
print $fh "Executed with no input on STDIN\n"; |
| 23 |
} |
| 24 |
|