Dealing with a STRANGE API
- From: Ignoramus7272 <ignoramus7272@xxxxxxxxxxxxxxxxxxx>
- Date: Fri, 06 Oct 2006 21:24:37 GMT
I am using PayPal API class
Business::PayPal::API::TransactionSearch
It uses some very weird code
my %response = ();
unless( $self->getBasic($som, $path, \%response) ) {
$self->getErrors($som, $path, \%response);
return %response;
}
return $self->getFieldsList( $som, $path . '/PaymentTransactions',
{ Timestamp => 'Timestamp',
Timezone => 'Timezone',
Type => 'Type',
Payer => 'Payer',
PayerDisplayName => 'PayerDisplayName',
TransactionID => 'TransactionID',
Status => 'Status',
GrossAmount => 'GrossAmount',
FeeAmount => 'FeeAmount',
NetAmount => 'NetAmount',
} );
that is, it returns a hash when there is error, and a list reference when there is not.
I am bewildered, just how can I get this result into one variable and
then figure out if I am dealing with success (so that I can print
results from the list reference), or failure (so that I can print a
hash element error message).
Any idea? I tried obvious things like setting a scalar to the result
of this function, and could not.
The man pages gloss over this issue. I did read them in their entirety.
i
.
- Follow-Ups:
- Re: Dealing with a STRANGE API
- From: anno4000
- Re: Dealing with a STRANGE API
- Prev by Date: Re: Posting Guidelines for comp.lang.perl.misc ($Revision: 1.6 $)
- Next by Date: Re: Posting Guidelines for comp.lang.perl.misc ($Revision: 1.6 $)
- Previous by thread: FAQ 2.1 What machines support perl? Where do I get it?
- Next by thread: Re: Dealing with a STRANGE API
- Index(es):