Catmandu::FedoraCommons::Response(3pm) | User Contributed Perl Documentation | Catmandu::FedoraCommons::Response(3pm) |
Catmandu::FedoraCommons::Response - Perl model for generic Fedora Commons REST API responses
use Catmandu::FedoraCommons; my $fedora = Catmandu::FedoraCommons->new('http://localhost:8080/fedora','fedoraAdmin','fedoraAdmin'); my $result = $fedora->findObjects(terms=>'*'); die $resut->error unless $result->is_ok; my $obj = $result->parse_content; $result->is_ok; $result->error; $result->raw; $result->content_type; $result->length; $result->date; $result->parse_content(); $result->parse_content($my_model);
A Catmandu::FedoraCommons::Response gets returned for every Catmandu::FedoraCommons method. This response contains the raw HTTP content of a Fedora Commons request and can also be used to parse XML responses into Perl objects using the parse_content function. For more information on the Perl objects see the information in the Catmandu::FedoraCommons::Model packages.
Returns true when the result Fedora Commons response contains no errors.
Returns the error message of the Fedora Commons response if available.
Returns a Perl representation of the Fedora Commons response. Optionally a model object can be provided that implements a $obj->parse($bytes) method and returns a Perl object. If no model is provided then default models from the Catmandu::FedoraCommons::Model namespace are used.
Example: package MyParser; sub new { my $class = shift; return bless {} , $class; } sub parse { my ($self,$bytes) = @_; ... return $perl } package main; my $fedora = Catmandu::FedoraCommons->new('http://localhost:8080/fedora','fedoraAdmin','fedoraAdmin'); my $result = $fedora->findObjects(terms=>'*'); my $perl = $result->parse_content(MyParser->new);
Returns the raw Fedora Commons response as a string.
Returns the Content-Type of the Fedora Commons response.
Returns the byte length of the Fedora Commons response.
Returns the date of the Fedora Commons response.
Catmandu::Model::findObjects, Catmandu::Model::getObjectHistory, Catmandu::Model::getObjectPrifule, Catmandu::Model::listDatastreams, Catmandu::Model::listMethods
2023-02-05 | perl v5.36.0 |