File: sendmail_tester

package info (click to toggle)
debbugs 2.6.4
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 1,800 kB
  • sloc: perl: 19,270; makefile: 81; sh: 75
file content (21 lines) | stat: -rwxr-xr-x 645 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
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 = IO::File->new($fn ,'w') or die "Unable to open file $fn for writing: $!";

print {$fh} "$0 called with: ", join(' ',map {"'$_'"} @ARGV) or die "Unable to write to file $fn: $!";
print {$fh} "\n\n";
print {$fh} <STDIN> or die "Unable to write to file $fn: $!";

close $fh or die "Unable to close file $fn: $!";