29 |
|
|
30 |
# open log and redirect die to it... |
# open log and redirect die to it... |
31 |
open(LOG,">> $log") || warn "open log $log: $!"; |
open(LOG,">> $log") || warn "open log $log: $!"; |
32 |
local $SIG{__DIE__} = sub { print scalar localtime LOG $_[0] ; die $_[0] }; |
local $SIG{__DIE__} = sub { print LOG scalar localtime,$_[0] ; die $_[0] }; |
33 |
|
|
34 |
umask 022; # world readable |
umask 022; # world readable |
35 |
|
|
44 |
if (@parts) { # multipart... |
if (@parts) { # multipart... |
45 |
map { dump_entity($_) } @parts; |
map { dump_entity($_) } @parts; |
46 |
} else { # single part... |
} else { # single part... |
47 |
# print " Part: ", $ent->bodyhandle->path, |
print LOG scalar localtime," Att: ", $ent->bodyhandle->path, " (", scalar($ent->head->mime_type), ")\n"; |
48 |
# " (", scalar($ent->head->mime_type), ")\n"; |
if ($ent->head->mime_type =~ m,text/plain,i && $ent->bodyhandle->path !~ m/(Orders|edi)/i) { |
|
if ($ent->head->mime_type =~ m,text/plain,i) { |
|
49 |
# open(I,$ent->bodyhandle->path) || die "$ent->bodyhandle->path: $!"; |
# open(I,$ent->bodyhandle->path) || die "$ent->bodyhandle->path: $!"; |
50 |
# while(<I>) { print LOG $_; } |
# while(<I>) { print LOG $_; } |
51 |
# close(I); |
# close(I); |
63 |
$new .= $suffix; |
$new .= $suffix; |
64 |
|
|
65 |
rename $file,"$outdir/$new" || die "move $file -> $outdir/$new: $!"; |
rename $file,"$outdir/$new" || die "move $file -> $outdir/$new: $!"; |
|
my $prog = $0; |
|
|
$prog =~ s/^.*\/([^\/])+$/$1/g; |
|
|
print LOG scalar localtime," $prog $new\n"; |
|
66 |
|
|
67 |
# now, call SAP rfc |
# now, call SAP rfc |
68 |
|
|
90 |
|
|
91 |
$it->FILENAME( $new ); |
$it->FILENAME( $new ); |
92 |
|
|
93 |
|
print LOG scalar localtime," RFC: $new\n"; |
94 |
$rfc->callrfc( $it ); |
$rfc->callrfc( $it ); |
95 |
|
|
96 |
$rfc->close(); |
$rfc->close(); |