HTTP::...ecords(3pm)

πŸ“¦
version 4.13 Β· 5 versions
, in debian trixie, ubuntu noble, ubuntu resolute, ubuntu stonking

πŸ’– HTTP::OAI::ListRecords β€” the whole vibe πŸ’–

okay so bestie, welcome to the manual page for HTTP::OAI::ListRecords, part of the User Contributed Perl Documentation. It's giving OAI realness β€” specifically, it's the thing that hands you access to an OAI ListRecords response. Yes. That one. πŸŽ€


✨ NAME ✨

HTTP::OAI::ListRecords β€” bestie, it provides access to an OAI ListRecords response. That's the whole job. She's focused. She's booked. πŸ’…


🌸 SYNOPSIS 🌸

So here's how you actually use her. First up, the classic loop-it-yourself moment:

my $r = $h->ListRecords(
        metadataPrefix=>'oai_dc',
);

while( my $rec = $r->next ) {
        print "Identifier => ", $rec->identifier, "\n";
}

die $r->message if $r->is_error;

not the die at the end being the most important line in the whole file 😭 check your errors, bestie, she's begging you.

And then there's the callback method, for when you're feeling ✨extra✨:

# Using callback method
sub callback {
        my $rec = shift;
        print "Identifier => ", $rec->identifier, "\n";
};
my $r = $h->ListRecords(
        metadataPrefix=>'oai_dc',
        onRecord=>\&callback
);
die $r->message if $r->is_error;

Same energy, different delivery. Callback girlies, this one's for you. πŸ¦‹


πŸ‘‘ METHODS πŸ‘‘

🫢 $lr = new HTTP::OAI::ListRecords

This constructor method returns a new HTTP::OAI::ListRecords object. That's it. That's the method. Fresh object, fresh start, main character energy. ✨

πŸ“ $rec = $lr->next

Returns either an HTTP::OAI::Record object, or undef if no more records are available. And listen β€” use $rec->is_error to test whether there was an error getting the next record. Don't just assume the undef means "all done", because it might be screaming at you. πŸ‘€

πŸ’œ @recl = $lr->record([$rec])

Returns the record list, and optionally adds a new record or resumptionToken, $rec. Returns an array ref of HTTP::OAI::Records, including an optional resumptionToken string. Two jobs, one method, we love a multitasker.

🌈 $token = $lr->resumptionToken([$token])

Returns and optionally sets the HTTP::OAI::ResumptionToken. Give her a token and she'll set it; give her nothing and she'll hand you one. get you a method that can do both πŸ’…

⭐ $dom = $lr->toDOM

Returns a XML::DOM object representing the ListRecords response. Boom. DOM'd. πŸŽ€


quick reminder bestie: every one of these is a method on the object, so call them on $lr and not on the class. she's an instance girlie. πŸ’–

and that's the whole page, no cap. this was HTTP::...ecords(3pm) from the User Contributed Perl Documentation, running on perl v5.36.0, dated 2023-09-28. slay, hydrate, check your is_error, bye bestie πŸ’–βœ¨

πŸ“¦ where this page comes from