Hi,
thanks for all the help. I definitely will do a refresher of perlsub/perldata.
I built your suggestions into my code.
File data_sync_tool.pm:
while($sth->fetch()) {
# zusatz scheint NULL zu sein...
if(!defined($zusatz)) {
$zusatz = "";
}
print("$id => $plz => $stadt => $kurzname => $zusatz => $statu
+s => $typ\n");
# Hash zusammenbasteln
my %hash;
$hash{"kurzname"} = $kurzname;
$hash{"plz"} = $plz;
$hash{"stadt"} = $stadt;
$hash{"status"} = $status;
$hash{"typ"} = $typ;
$hash{"zusatz"} = $zusatz;
push(@ary,\%hash);
}
$sth->finish();
# evtl. Fehlerbehandlung
my $laenge = @ary;
if($laenge > 0) {
eval {
print("DataSyncTool: @ary\n");
$dss->updatePLZInformationen(\@ary); # $dss = instance
+of data_service.pm
};
if($@) {
# Fehler ausgeben
chop($@);
if($debug == 1) { &debug_out("updatePLZInformationen => FE
+HLER:\n$@\n") };
$err_txt .= "updatePLZInformationen => FEHLER:\n$@\n";
}
}
File data_service.pm:
sub updatePLZInformationen() {
# überträgt geänderte PLZ-Daten
my $data = shift;
print("Yeehah: $data\n");
my $plz = SOAP::Lite
-> service('file:/home/orca/oracle/DataSyncTool/config/SKADataServ
+ice.wsdl');
$plz->updatePLZInformationen(
SOAP::Data->type("xsd:string")->name("clientid" => "ska")->val
+ue,
SOAP::Data->type("xsd:string")->name("securitytoken" => "ska")
+->value,
SOAP::Data->type("tns2:PLZInfo")->name("plzinfos")->value(
\SOAP::Data->value(
&format_plz_infos($data)
)
)
);
}
# --------------------------------------------------------------------
+---------------------------- #
sub format_plz_infos() {
# formatiert den komplexen Typ "plzinfo"
my $plz = shift;
my @plz_info;
print("Yeehah: $plz\n");
foreach(@$plz) {
my $hash = $_;
push(@plz_info,SOAP::Data->name("kurzname")->value($hash->{"ku
+rzname"})->type("xsd:string"));
push(@plz_info,SOAP::Data->name("plz")->value($hash->{"plz"})-
+>type("xsd:string"));
push(@plz_info,SOAP::Data->name("stadt")->value($hash->{"stadt
+"})->type("xsd:string"));
push(@plz_info,SOAP::Data->name("status")->value($hash->{"stat
+us"})->type("xsd:string"));
push(@plz_info,SOAP::Data->name("typ")->value($hash->{"typ"})-
+>type("xsd:string"));
push(@plz_info,SOAP::Data->name("zusatz")->value($hash->{"zusa
+tz"})->type("xsd:string"));
}
return(@plz_info);
}
# --------------------------------------------------------------------
+---------------------------- #
And here's the output:
test@testmachine:~/test/DataSyncTool> ./data_sync_tool.pl
16:12:2008 09:14:13, DEBUG: Programm gestartet...
16:12:2008 09:14:13, DEBUG: updatePLZInformationen => Data of plz tabl
+e:
1 => 01001 => Dresden => Dresden => => 1 => 3
2 => 01002 => Dresden => Dresden => => 1 => 3
3 => 01003 => Dresden => Dresden => => 1 => 3
4 => 01004 => Dresden => Dresden => => 1 => 3
DataSyncTool: HASH(0x86d81f8) HASH(0x8740d38) HASH(0x88058c0) HASH(0x8
+805920)
Yeehah: DatenService=HASH(0x8743344)
Yeehah: DatenService=HASH(0x8743344)
16:12:2008 09:14:13, DEBUG: updatePLZInformationen => FEHLER:
Not an ARRAY reference at data_service.pm line 161.
16:12:2008 09:14:13, DEBUG: updatePLZInformationen => Fertig.
The error message is in the subroutine format_plz_infos():
foreach(@$plz) {
...
}
I'm no perl specialist, unfortunately, and I surely have a lack of basics, but I really need some advice to get this client working... :-/
Thanks in advance,
Thion
-
Are you posting in the right place? Check out Where do I post X? to know for sure.
-
Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
<code> <a> <b> <big>
<blockquote> <br /> <dd>
<dl> <dt> <em> <font>
<h1> <h2> <h3> <h4>
<h5> <h6> <hr /> <i>
<li> <nbsp> <ol> <p>
<small> <strike> <strong>
<sub> <sup> <table>
<td> <th> <tr> <tt>
<u> <ul>
-
Snippets of code should be wrapped in
<code> tags not
<pre> tags. In fact, <pre>
tags should generally be avoided. If they must
be used, extreme care should be
taken to ensure that their contents do not
have long lines (<70 chars), in order to prevent
horizontal scrolling (and possible janitor
intervention).
-
Want more info? How to link
or How to display code and escape characters
are good places to start.