in reply to XML module advice

Essentially this is a trivial use of XML. The data could just as easily have been sent as Field: Value. You could quite easily just interpolate values into a post string to get the required format for the post data and then use LWP::UserAgent to do the POST and accept the REPLY. To parse the sort of trivial reply you have to deal with you could use XML::Simple. If you are certain that the XML will always be well formed you could use a simple RE (but this is not recommended)....

while(<DATA>){ next unless m!^\s*<([^>]+)>([^<]+)</(\1)>!; $h{$1}=$2; } use Data::Dumper; print Dumper \%h; __DATA__ <Reply> <TransactionReply> <ResponseCode>0</ResponseCode> <ResultCode>00</ResultCode> <ResultMessage>APPROVED</ResultMessage> <TransactionID>100000182165</TransactionID> <AVSResponseCode /> <CVVResponseCode /> <ApprovalNumber>123456</ApprovalNumber> <AuthorizationNumber>123456</AuthorizationNumber> <TransactionDate>021112</TransactionDate> <TransactionTime>110544</TransactionTime> <ReferenceNumber>1234</ReferenceNumber> <AccountNumber>XXXXXXXXXXXX1111</AccountNumber> <TransactionAmount>1.00</TransactionAmount> </TransactionReply> </Reply>

cheers

tachyon

Replies are listed 'Best First'.
Re^2: XML module advice
by Anonymous Monk on Jun 07, 2004 at 09:36 UTC
    Don't forget to decode any XML escaped charaters in the value ($2).