I am consuming XML service using LWP. And I am parsing XML using XML::Simple. And I have to assign parsed variables to string. When I view variables in browser it shows normal.I am developing KOHA and it uses Template toolkit.
But when I add variables values to database (I am using mysql) it inserted as a HASH. How can I solve this?
My code isThe main problem is assign parsed xml real value to variable.Not a HASH. Thank you.my $rfid= $input->param('rfid'); my $ua = LWP::UserAgent->new; my $response = $ua->get("https:/mywebpage.com/studentservice/s +ervice.asmx/give_to_koha_byStudentCard?cardNR=$rfid"); my $xml=$response->content; # parse my $xs = new XML::Simple(keeproot =>0,searchpath => ".",forcea +rray => 1,); my $ref = $xs->XMLin($xml); my $firstname=${$ref->{firstname}}[0]; my $lastname=${$ref->{lastname}}[0]; my $sisiid=${$ref->{sisiid}}[0]; my $school=${$ref->{school}}[0]; my $program=${$ref->{program}}[0]; my $registerNr=${$ref->{registerNr}}[0]; my $userStatus=${$ref->{userStatus}}[0]; my $usertype=${$ref->{usertype}}[0]; my $photo=${$ref->{photo}}[0]; my $branch=${$ref->{abbrevm}}[0]; my $op= $input->param('op'); # save when op= "save" my %newdata; if($op eq "save"){ %newdata =("cardnumber"=>"$rfid", "surname"=>"$lastname", "firstname"=>"$firstname", "initials"=>"$registerNr", "address"=>"$program", "userid"=>"$sisiid", "categorycode"=>'ST', "branchcode"=>'EZS', "password"=>'aaaaaaa' ); my $borrowernumber=&AddMember(%newdata);
In reply to {KOHA}Parse XML and assign to variables. by scolife
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |