SRU::Request(3pm)

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

πŸ’– SRU::Request πŸ’–

okay bestie, welcome to SRU::Request from the User Contributed Perl Documentation corner of the universe β€” it's the factory zone where SRU request objects get built ✨


🌸 NAME 🌸

SRU::Request β€” literally just factories for creating SRU request objects. that's the whole job. iconic.


πŸŽ€ SYNOPSIS πŸŽ€

use SRU::Request;
my $request = SRU::Request->newFromURI( $uri );

like… that's it. two lines. you're already slaying πŸ’…


πŸ¦‹ DESCRIPTION πŸ¦‹

so here's the vibe: SRU::Request lets you spin up the right SRU request object from a URI object. you hand it a URI, it hands you back one of SRU::Request::Explain, SRU::Request::Scan or SRU::Request::SearchRetrieve β€” whichever one matches the type of URI you passed in. no cap, it just knows.

and if you wanna know what's actually inside those objects? go read the docs for those classes, bestie, they have the lore πŸ“š


πŸ‘‘ METHODS πŸ‘‘

✨ new( %query | $uri | $cgi | $env ) ✨

creates a brand new request object, and it's gonna be one of these three:

  • SRU::Request::Explain
  • SRU::Request::Scan
  • SRU::Request::SearchRetrieve

and the way you can feed it params?? so many options, main character energy fr:

  • as a hash of query parameters
  • as a URL
  • as a URI
  • as a CGI object
  • as a PSGI request
⚠️ but listen β€” if the request isn't formatted properly, the call returns undef. and the error you hit should be chillin' in $SRU::Error. so check that, okay?? don't just sit there wondering why it's undef πŸ’€

🌈 newFromURI 🌈

🌈 newFromCGI 🌈

these two are deprecated aliases for "new". like they still work but they're giving old money that ran out of money. use new instead, periodt.


πŸ’œ asXML() πŸ’œ

this one generates the <echoedExplainRequest>, <echoedSearchRetrieveRequest> and <echoedScanRequest> elements in the response. it's the ✨echo✨ of your request, living its best life in the XML.


πŸ“ asURI( [ $base ] ) πŸ“

creates a URI of this request. 🫢

the optional base URL β€” you can pass it as a string or as a URI β€” defaults to http://localhost/ if you don't give it one. lowkey a nice little default ngl.


⭐ type() ⭐

returns 'searchRetrieve', 'scan' or 'explain' depending on what type of object it is. it's giving "tell me who you really are" πŸ”₯


this software is copyright (c) 2013 by Ed Summers.

it's free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself. slay, open source behavior πŸ’–


and that's the whole page, bestie!! brought to you by perl v5.34.0, dated 2022-06-17, and yes this was SRU::Request(3pm) the entire time 🌸✨ go build some requests, you've got this πŸ‘‘πŸ’…

πŸ“¦ where this page comes from