Blat run from Perl

#!perl
use strict;
use warnings;

my $Debug=0; # =0 gets NO console output
my ($DTS, $SMTP, $subject, $body);
DTS(); # go build the Date Time Stamp

$SMTP="localhost"; # the SMTP mail server name or IP address

$subject="\"Testing blat $DTS\"";

my %Envelope = ( # Envelope bits
    -f  => 'tim@blat.tld', # FROM:
    -to => 'tim@blat.tld', # TO:
);

my %Data = ( # Data bits
        # you can add other parms here as needed
    -subject  => $subject,   # just what it sounds like!
    -server   => $SMTP,      # specify the SMTP server to use
    -debug    => " ",        # run Blat with debuging output
    -log      => "\"$0.log\"", # dump screen output to a file instead.
);

GetBodyFromFile($0); # go get the message body from a file
                # put "D:/path/filename.txt" in place of $0 to use your own file
# $body = 'You can also set the $body Variable directly if you don\'t want to get the message body from a file';

SendIt($body, %Envelope, %Data);

sub SendIt {
        my $BlatCmd="Blat.exe"; # the Blat binary (path if needed)
        
        my $body = shift @_; # get the msg body
        $BlatCmd .= " - @_"; # add all the parms
        # now we have something like
        # blat.exe - -f tim@blat.tld -to tim@blat.tdl
        #          -debug -log "C:\mail\tims-blat.pl.log"
        #          -server localhost
        #          -subject "Testing blat 2003-8-20 12:46:6"

        print "\n\nCommand Line = $BlatCmd\n\nMessage Body = $body\n" if $Debug;

        open (MAIL, "| $BlatCmd") || die $!; # start Blat with all it's parms
        print MAIL $body; # now put in the msg body (bigger this way than CL)
}

sub DTS { # build the Date Time Stamp
        #Sec=$T[0],M=1,H=2, mDay=3,Mon=4,Yr=5, wDay=6,yDay=7, isDST=8
        my (@T)=localtime; ++$T[4]; $T[5]+=1900;
        $DTS = qq[$T[5]-$T[4]-$T[3] $T[2]:$T[1]:$T[0]];
}

sub GetBodyFromFile {
        my $file = shift @_;
        local $/; # set the 'input record separator' to nothing
        open INFO, $file or die "Cannot open $file: $!"; # open it
        $body = <INFO>; # slurp it into $body
}

# v1.0.2 - some code tweeks and cleanup (2003/08)
# v1.0.1 - get the body from a file (this one)
# v1.0.0 2002/09 Perl wrapper for Blat by Tim Musson
# First iteration is command line
# to do - make it a CGI app.