Catman...esponse(3pm)
π Catmandu::FedoraCommons::Response β the vibe check β¨
ok bestie so this is the Catman...esponse(3pm) page from the User Contributed Perl Documentation, and it's literally the glow-up guide for Catmandu::FedoraCommons::Response, aka the Perl model for generic Fedora Commons REST API responses π
πΈ NAME πΈ
Catmandu::FedoraCommons::Response β it's the Perl model for generic Fedora Commons REST API responses, no cap π¦
β¨ SYNOPSIS β¨
like, here's the whole entire moment:
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);
(yes $resut is in there with a lil typo, we keep it exactly as-is, it's iconic π
)
π«Ά DESCRIPTION π«Ά
so a Catmandu::FedoraCommons::Response gets returned for every Catmandu::FedoraCommons method. every single one. it's giving loyal.
this response is holding the raw HTTP content of a Fedora Commons request, and it can also be used to parse XML responses into Perl objects using the parse_content function. obsessed.
if you want more info on the Perl objects, go read the info in the Catmandu::FedoraCommons::Model packages π
π§ METHODS π§
π is_ok()
Returns true when the result Fedora Commons response contains no errors. it's the vibe check of methods.
π error()
Returns the error message of the Fedora Commons response if available. (if available β so like, maybe there's no tea to spill π)
π 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. slay.
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. straight up, no filter.
π content_type()
Returns the Content-Type of the Fedora Commons response. main character metadata fr fr.
π length()
Returns the byte length of the Fedora Commons response. it knows its own size and honestly? good for it π
π date()
Returns the date of the Fedora Commons response. timestamped and iconic β
π AUTHORS π
- Patrick Hochstenbach,
"<patrick.hochstenbach at ugent.be>"β the legend himself, giving us this whole page π
π SEE ALSO π
Catmandu::Model::findObjects, Catmandu::Model::getObjectHistory, Catmandu::Model::getObjectPrifule, Catmandu::Model::listDatastreams, Catmandu::Model::listMethods
(and yes, getObjectPrifule is spelled exactly like that, we do not correct the king π)
ok that's the whole thing, mwah π this page is from perl v5.36.0, dated 2023-02-05, and it's part of the Catman...esponse(3pm) moment. love that for us. bye bestie π¦β¨
π¦ where this page comes from
- debian bookworm: libcatmandu-fedoracommons-perl 0.5-2 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- debian trixie: libcatmandu-fedoracommons-perl 0.5-2 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu noble: libcatmandu-fedoracommons-perl 0.5-2 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu resolute: libcatmandu-fedoracommons-perl 0.5-2 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu stonking: libcatmandu-fedoracommons-perl 0.5-2 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms