WebService-Etsy
view release on metacpan or search on metacpan
lib/WebService/Etsy/Response.pm view on Meta::CPAN
An arrayref of L<WebService::Etsy::Resource> objects. Using the Response object as an arrayref accesses this results arrayref.
=item C<params()>
A hashref of the parameters supplied to the method call.
=item C<count()>
The number of results found (not necessarily the number returned).
=item C<type()>
The Resource objects' type.
=back
=head1 AUTOLOADED METHODS
As a convenience, the Response object will accept method calls the belong to its Resource objects. The method calls will be executed on the first object in the results arrayref. This allows you to use the Response object just like a Resource object, ...
Note that C<WebService::Etsy::Method> objects include methods that collide with C<WebService::Etsy::Response> object methods, in which case you'll need to use the longer form of C<$resp-E<gt>[ 0 ]-E<gt>method()> (although this shouldn't matter too mu...
These methods are generated using C<AUTOLOAD>, and so won't be picked up by C<can()> etc.
=cut
use overload
'""' => "stringify",
'@{}' => "array",
fallback => 1,
;
sub stringify {
return join ",", @{ $_[ 0 ]->results };
}
sub array {
return $_[ 0 ]->results;
}
sub AUTOLOAD {
my $self = shift;
$AUTOLOAD =~ /::([^:]*?)$/;
my $method = $1;
if ( $self->results->[ 0 ]->can( $method ) ) {
return $self->results->[ 0 ]->$method( @_ );
} else {
croak "No such method: $method";
}
}
sub DESTROY {
}
=head1 SEE ALSO
L<http://developer.etsy.com/docs#api_response_structure>, L<WebService::Etsy::Resource>.
=head1 AUTHOR
Ian Malpass (ian-cpan@indecorous.com)
=head1 COPYRIGHT
Copyright 2009, Ian Malpass
This library is free software; you can redistribute it and/or modify it
under the same terms as Perl itself.
=cut
1;
( run in 1.482 second using v1.01-cache-2.11-cpan-75ffa21a3d4 )