IO::All::HTTP(3pm)

πŸ’– IO::All::HTTP β€” bestie's guide to HTTP URLs in IO::All πŸ’–

okay so this is the IO::All::HTTP page from the Perl docs (perl v5.32.0, dated 2021-01-04, and it lives in the User Contributed Perl Documentation section). it's short, it's sweet, and it makes HTTP URLs feel like just another file. periodt. πŸ¦‹


✨ NAME ✨

IO::All::LWP β€” extends IO::All to HTTP URLs. yes bestie, the NAME says IO::All::LWP even though the page is IO::All::HTTP. that's not a typo on my part, that's just how it is, we don't question it. πŸ’…


🌸 SYNOPSIS 🌸

like, look at how cute this is:

use IO::All;

$content < io('http://example.org');             # GET webpage into scalar
io('http://example.org') > io('index.html');     # GET to file
"hello\n" > io('http://example.org/index.html'); # PUT webpage

# two ways of getting a page with a password:
$content < io('http://me:secret@example.org');
$content < io('http://example.org')->user('me')->password('secret');

no cap, that's the whole vibe. πŸ’–


πŸŽ€ DESCRIPTION πŸŽ€

so this module extends IO::All so it can deal with HTTP URLs. and here's the gag: you don't even have to use it explicitly, because IO::All autoloads it whenever it sees something that looks like an HTTP URL. it just knows. main character energy fr fr. πŸ‘‘

the SYNOPSIS above shows the simple typical examples, but lowkey there are so many other interesting combinations with other IO::All features!! for example, you can GET an HTTP URL and then write that content to a socket, or to an FTP URL, or to a DBM file. the way that it just composes with everything?? obsessed. ✨


πŸ’… METHODS πŸ’…

this is a subclass of IO::All::LWP. the only new method is http, and you can use it to create a blank IO::All::HTTP object, or it can also take an HTTP URL as a parameter.

ngl though, in most cases it's simpler to just call io('http://example.com'), which calls the http method automatically for you. let the module do the work, bestie, you deserve it. 🫢


πŸ”₯ OPERATOR OVERLOADING πŸ”₯

the same operators from IO::All still work here:

  • < β€” GETs an HTTP URL
  • > β€” PUTs to an HTTP URL

that's it, that's the whole section. iconic. πŸ’€


🌈 SEE ALSO 🌈

  • IO::All
  • IO::All::LWP
  • LWP

go read those too, iykyk. πŸ“š


πŸ‘‘ AUTHORS πŸ‘‘

Ivan Tubert-Brohman <itub@cpan.org> and Brian Ingerson <ingy@cpan.org> β€” absolute legends, we stan. πŸ’œ


Copyright (c) 2007. Ivan Tubert-Brohman and Brian Ingerson. All rights reserved.

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

See <http://www.perl.com/perl/misc/Artistic.html>


and that's the whole page!! 🧚 mwah, bye bestie β€” this was IO::All::HTTP(3pm) from perl v5.32.0, last touched 2021-01-04, straight out of the User Contributed Perl Documentation. slay. βœ¨πŸ’–πŸŽ€

πŸ“¦ where this page comes from