--- mail2sap.pl 2002/11/19 08:34:40 1.2 +++ mail2sap.pl 2002/11/19 09:03:22 1.3 @@ -11,15 +11,19 @@ use SAP::Rfc; use Digest::MD5 qw(md5_hex); use MIME::Parser; +use XML::Simple; +use Data::Dumper; -# configuration +# read configuration from xml file +my $config = XMLin(); # directory in which attachemnts will be left -my $outdir = "/var/autofs/data/export_sigma"; +my $outdir = $config->{outdir} || die "config: on defined"; # temporary directory (ON SAME FILESYSTEM AS $outdir -- we use rename!) # for extraction of *ALL* attachements -my $msgdir = "/var/autofs/data/export_sigma/mime$$"; # temp -my $log = "/data/sap_sigma/orders.log"; +my $msgdir = $config->{msgdir} || die "config: no defined"; +$msgdir .= "$$"; # append PID to make it unique +my $log = $config->{log} || die "config: no defined"; # open log and redirect die to it... open(LOG,">> $log") || warn "open log $log: $!"; @@ -28,13 +32,13 @@ # init SAP rfc # my $rfc = new SAP::Rfc( - ASHOST => 'cipkg', - USER => 'rfctest', - PASSWD => 'dinamo', - LANG => 'HR', - CLIENT => '200', - SYSNR => '20', - TRACE => '0' + ASHOST => $config->{sap}->{ashost}, + USER => $config->{sap}->{user}, + PASSWD => $config->{sap}->{passwd}, + LANG => $config->{sap}->{lang}, + CLIENT => $config->{sap}->{client}, + SYSNR => $config->{sap}->{sysnr}, + TRACE => $config->{sap}->{trace} ) || die "new: $!";