From 7a1f0b402b964162216d2411af0e1bee3de5cf06 Mon Sep 17 00:00:00 2001 From: Don Armstrong Date: Tue, 9 Jan 2007 22:21:54 -0800 Subject: [PATCH] add the sendmail test script which is used by 06_mail_handling.t --- t/sendmail_tester | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100755 t/sendmail_tester diff --git a/t/sendmail_tester b/t/sendmail_tester new file mode 100755 index 00000000..22f1e4c3 --- /dev/null +++ b/t/sendmail_tester @@ -0,0 +1,21 @@ +#!/usr/bin/perl + +# All this script does is write whatever is piped to it to a unique +# filename, with the first line containing the arguments sent. + +use IO::File; + +# create a unique filename +if (not -d $ENV{SENDMAIL_TESTDIR}) { + system('mkdir','-p',$ENV{SENDMAIL_TESTDIR}); +} + +my $fn = "$ENV{SENDMAIL_TESTDIR}/".time.$$; + +my $fh = new IO::File $fn ,'w' or die "Unable to open file $fn for writing: $!"; + +print {$fh} join(' ',map {"'$_'"} @ARGV) or die "Unable to write to file $fn: $!"; +print {$fh} "\n\n"; +print {$fh} <> or die "Unable to write to file $fn: $!"; + +close $fh or die "Unable to close file $fn: $!"; -- 2.39.5