FreeBSD Manual Pages
WebService::GData::ErrUser)Contributed Perl DocumenWebService::GData::Error(3) NAME WebService::GData::Error - create an error and parse errors from Google data APIs v2. SYNOPSIS use WebService::GData::Error; #create an error object that you can throw by dying... my $error = new WebService::GData::Error(401,'Unauthorized'); # $error->code; # $error->content; #create an error object in response to a Google Service. my $error = new WebService::GData::Error(401,$responseFromAService); print $error->code; print $error->content;#raw xml content my @errors = $error->errors;#send back WebService::GData::Error::Entry objects foreach my $error (@{$error->errors}){ print $error->code; print $error->internalreason; print $error->domain; print $error->location->{type};#this is just a hash print $error->location->{content};#this is just a hash } DESCRIPTION inherits from WebService::GData. This package can parse error response from Google APIs service. You can also create your own basic error. All WebService::GData::* classes die a WebService::GData::Error object when something goes wrong. You should use an eval {}; block to catch the error. Example: use WebService::GData::Base; my $base = new WebService::GData::Base(); eval { $base->get($url); }; #$error is a WebService::GData::Error; if(my $error=$@){ #error->code,$error->content, $error->errors } CONSTRUCTOR new Create a WebService::GData::Error instance. Will parse the contents that you can access via the errors() method of the instance. Parameters "code:*" - This could be an http status or a short string error_code. "content:Scalar" - The string can be a Google xml error response, in which case, it will get parsed. Returns WebService::GData::Error Example: use WebService::GData::Error; #create an error object that you can throw by dying... my $error = new WebService::GData::Error(401,'Unauthorized'); GET METHODS code Get back the error code. Parameters "none" Returns "code:Scalar" Example: use WebService::GData::Error; #create an error object that you can throw by dying... my $error = new WebService::GData::Error(401,'Unauthorized'); $error->code;#401 content Get back the raw content of the error. When getting an error from querying one of Google data services, you will get a raw xml response containing possible errors. In such case,you should loop through the result by using the errors() instance which send back WebService::GData::Error::Entry. Parameters "none" Returns "content:Scalar" Example: use WebService::GData::Error; #create an error object that you can throw by dying... my $error = new WebService::GData::Error(401,'Unauthorized'); $error->content;#Unauthorized errors Get back a reference array filled with WebService::GData::Error::Entry. When getting an error from querying one of Google data services, you will get an xml response containing possible errors. In such a case,you should loop through the result of errors. Errors always send back a reference array (even if there is no error). Parameters "none" Returns WebService::GData::Error::Entry:ArrayRef Example: my @errors = $error->errors;#send back WebService::GData::Error::Entry objects foreach my $error (@{$error->errors}){ print $error->code; print $error->internalreason; print $error->domain; print $error->location->{type};#this is just a hash print $error->location->{content};#this is just a hash } BUGS AND LIMITATIONS If you do me the favor to _use_ this module and find a bug, please email me i will try to do my best to fix it (patches welcome)! AUTHOR shiriru <shirirulestheworld[arobas]gmail.com> LICENSE AND COPYRIGHT This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself. POD ERRORS Hey! The above document had some coding errors, which are explained below: Around line 153: =back without =over Around line 181: =back without =over perl v5.32.1 2010-11-01 WebService::GData::Error(3)
NAME | SYNOPSIS | DESCRIPTION | BUGS AND LIMITATIONS | AUTHOR | LICENSE AND COPYRIGHT | POD ERRORS
Want to link to this manual page? Use this URL:
<https://www.freebsd.org/cgi/man.cgi?query=WebService::GData::Error&sektion=3&manpath=FreeBSD+13.0-RELEASE+and+Ports>