11 |
use SAP::Rfc; |
use SAP::Rfc; |
12 |
use Digest::MD5 qw(md5_hex); |
use Digest::MD5 qw(md5_hex); |
13 |
use MIME::Parser; |
use MIME::Parser; |
14 |
|
use XML::Simple; |
15 |
|
use Data::Dumper; |
16 |
|
|
17 |
# configuration |
# read configuration from xml file |
18 |
|
my $config = XMLin(); |
19 |
|
|
20 |
# directory in which attachemnts will be left |
# directory in which attachemnts will be left |
21 |
my $outdir = "/var/autofs/data/export_sigma"; |
my $outdir = $config->{outdir} || die "config: on <outdir> defined"; |
22 |
# temporary directory (ON SAME FILESYSTEM AS $outdir -- we use rename!) |
# temporary directory (ON SAME FILESYSTEM AS $outdir -- we use rename!) |
23 |
# for extraction of *ALL* attachements |
# for extraction of *ALL* attachements |
24 |
my $msgdir = "/var/autofs/data/export_sigma/mime$$"; # temp |
my $msgdir = $config->{msgdir} || die "config: no <msgdir> defined"; |
25 |
my $log = "/data/sap_sigma/orders.log"; |
$msgdir .= "$$"; # append PID to make it unique |
26 |
|
my $log = $config->{log} || die "config: no <log> defined"; |
27 |
|
|
28 |
# open log and redirect die to it... |
# open log and redirect die to it... |
29 |
open(LOG,">> $log") || warn "open log $log: $!"; |
open(LOG,">> $log") || warn "open log $log: $!"; |
32 |
# init SAP rfc |
# init SAP rfc |
33 |
# |
# |
34 |
my $rfc = new SAP::Rfc( |
my $rfc = new SAP::Rfc( |
35 |
ASHOST => 'cipkg', |
ASHOST => $config->{sap}->{ashost}, |
36 |
USER => 'rfctest', |
USER => $config->{sap}->{user}, |
37 |
PASSWD => 'dinamo', |
PASSWD => $config->{sap}->{passwd}, |
38 |
LANG => 'HR', |
LANG => $config->{sap}->{lang}, |
39 |
CLIENT => '200', |
CLIENT => $config->{sap}->{client}, |
40 |
SYSNR => '20', |
SYSNR => $config->{sap}->{sysnr}, |
41 |
TRACE => '0' |
TRACE => $config->{sap}->{trace} |
42 |
) || die "new: $!"; |
) || die "new: $!"; |
43 |
|
|
44 |
|
|