Provided by: libcatmandu-fedoracommons-perl_0.5-2_all bug

NAME

       Catmandu::FedoraCommons::Response - Perl model for generic Fedora Commons REST API
       responses

SYNOPSIS

         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);

DESCRIPTION

       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.

   METHODS
   is_ok()
       Returns true when the result Fedora Commons response contains no errors.

   error()
       Returns the error message of the Fedora Commons response if available.

   parse_content($model)
       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);

   raw()
       Returns the raw Fedora Commons response as a string.

   content_type()
       Returns the Content-Type of the Fedora Commons response.

   length()
       Returns the byte length of the Fedora Commons response.

   date()
       Returns the date of the Fedora Commons response.

AUTHORS

       •   Patrick Hochstenbach, "<patrick.hochstenbach at ugent.be>"

SEE ALSO

       Catmandu::Model::findObjects, Catmandu::Model::getObjectHistory,
       Catmandu::Model::getObjectPrifule, Catmandu::Model::listDatastreams,
       Catmandu::Model::listMethods