WWW::O...esponse(3pm)

πŸ“¦
version 0.17 Β· 2 versions
  • 0.17 Β· debian bookworm, debian trixie, ubuntu noble, ubuntu resolute, ubuntu stonking (latest)
  • 0.17 Β· ubuntu jammy
, in debian bookworm, debian trixie, ubuntu noble, ubuntu resolute, ubuntu stonking

✨ NAME ✨

WWW::OpenSearch::Response β€” bestie, it wraps up a response you got back from an A9 OpenSearch compatible engine πŸ’–


🌸 SYNOPSIS 🌸

okay so first you gotta load it, then it's giving very demure, very mindful:

use WWW::OpenSearch;

my $url = "http://bulkfeeds.net/opensearch.xml";
my $engine = WWW::OpenSearch->new($url);

# Retrieve page 4 of search results for "iPod"
my $response = $engine->search("iPod",{ startPage => 4 });
for my $item (@{$response->feed->items}) {
    print $item->{description};
}

# Retrieve page 3 of results
$response = $response->previous_page;

# Retrieve page 5 of results
$response = $response->next_page;

like, paging through search results has never been this cunty πŸ¦‹


πŸŽ€ DESCRIPTION πŸŽ€

WWW::OpenSearch::Response is the module that exists purely to encapsulate a response received from an A9 OpenSearch compatible engine πŸ’…. If you want the lore, the spec is at http://opensearch.a9.com/spec/1.1/response/ β€” go read it, iykyk ✨


πŸ‘‘ CONSTRUCTOR πŸ‘‘

new( $response )

Builds you a brand new WWW::OpenSearch::Response instance, constructed from the WWWW::OpenSearch:Response that the search request handed back 🫢. (yes bestie, that typo is in the original, we're keeping her, no cap πŸ’€)


πŸ”₯ METHODS πŸ”₯

parse_response( )

Parses the content of the HTTP response using XML::Feed πŸ“–. And if that goes well? parse_feed( ) gets called too. slay ✨

parse_feed( )

Parses the XML::Feed that was originally parsed out of the HTTP response content 🌸. Then it sets the pager object appropriately, as it should πŸ’…

previous_page( ) / next_page( )

Runs another search on the parent object, and hands you back a WWW::OpenSearch::Response instance holding the previous/next page of results πŸ’–.

Here's the tea tho β˜•: if the current response already includes a <link rel="previous/next" href="..." /> tag, then the page is literally just the parsed content of the URL that the tag's href attribute points at, periodt. BUT β€” and this is the plot twist β€” if the current response does not include the appropriate link, then a whole new query gets constructed using the startPage or startIndex query arguments πŸ”₯. so either way you're getting your page, bestie.

Grabs the href attribute of the very first link whose rel attribute is equal to $type 🎯 (underscore gang, this one's internal, iykyk).


πŸ’œ ACCESSORS πŸ’œ

feed( )

pager( )

two lil accessors, doing their lil jobs, iconic behavior honestly πŸ‘‘


🌈 AUTHOR 🌈

the legends who made this happen:

  • Tatsuhiko Miyagawa <miyagawa@bulknews.net>
  • Brian Cassidy <bricas@cpan.org>

Copyright 2005-2013 by Tatsuhiko Miyagawa and Brian Cassidy

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself 🫢


fr fr, keep those terms intact, they're the whole vibe check πŸ’…

okay that's the whole page babes, perl v5.34.0, dated 2022-07-02, and this was WWW::O...esponse(3pm) β€” go forth and page through your search results, you absolute main character πŸŒŸπŸ’–βœ¨

πŸ“¦ where this page comes from