Arch::LiteWeb(3pm)

πŸ“¦ version 0.5.2, in ubuntu jammy

✨ Arch::LiteWeb ✨

okay bestie, so this is a <pink>User Contributed Perl Documentation</pink> page for Arch::LiteWeb β€” that's the 3pm manual section, iykyk πŸ’…. It's the whole "I just wanna grab a web page" situation, no drama, no giant dependency tree. Let's get into it 🫢


🌸 NAME 🌸

Arch::LiteWeb β€” the simple way to access web pages. that's it. that's the whole vibe. ✨


πŸ¦‹ SYNOPSIS πŸ¦‹

my $web = Arch::LiteWeb->new;
my $content = $web->get("http://some.domain:81/some/path");
die $web->error . " while processing " . $web->request_url
    unless $content;
my $content_type = $web->response_headers->{content_type};

see how chill that is?? you make an object, you get a url, you check the error, you read the headers. main character energy fr fr πŸ‘‘


πŸ’– DESCRIPTION πŸ’–

So this class gives you basic and easy-to-use client-side HTTP support. It exists literally so you don't have to depend on LWP. that's the whole point πŸŽ€

But listen β€” if having that dependency isn't a problem for you, the docs say to consider using LWP instead, because LWP provides much better support for HTTP and other protocols. no cap. this thing is the lite version on purpose πŸ’€


🌈 METHODS 🌈

here's the full roster of class methods available, bestie β€” all of them, no skipping:

get, post, request_url, error, error_with_url, network_error, response_code, response_codestr, response_error, response_headers, response_content.


πŸ’… get url [params ...]

Executes an HTTP get on the given url and returns the html string β€” or undef if there's a network/response error. If you want the deets about what went wrong or what came back, use the other methods, okurrr? 🧚

params is a key-value hash. These are the supported keys, every single one:

  • url_host β€” only used if url is none
  • url_port β€” only used if url is none (default: 80)
  • url_path β€” only used if url is none
  • endl β€” default is "\015\012"
  • timeout β€” default is 20 seconds
  • user_agent β€” default is "Arch::LiteWeb/0.1"
  • nocache β€” adds a no-cache header
  • noredirect β€” don't follow redirect responses
  • max_redirect_depth β€” default is 5
  • use_proxy β€” default is false
  • proxy_url β€” proxy url ($http_proxy supported too)
  • proxy_host β€” only used if proxy_url is none
  • proxy_port β€” only used if proxy_url is none (default: 80)

πŸ™ˆ post url input [params]

Not implemented yet. 😭 yeah bestie, it's giving "coming soon" but there's no eta. don't @ me.


⭐ request_url

The actual url of the last request that was issued β€” or undef. And here's the lil plot twist: if partial redirect responses are enabled, then the result is the last (non-redirect) url. slay, it tells you where you actually landed πŸ¦‹


πŸ’œ error

If the last request ended in an error (meaning get/post returned undef), this method returns the error message. Otherwise it returns undef. It's literally just a shortcut for:

network_error || response_error

iconic and efficient. periodt. ✨


πŸŽ€ error_with_url

Like error, but with this text appended if it's non-undef:

"\nwhile fetching request_url\n"

so now you get the url context too, bestie. very demure, very mindful πŸ’…


🌸 network_error

The network error message for the last request, or undef.


🌺 response_error

The response error message for the last request, or undef.


πŸ“ response_code

The last response code as an integer, or undef.


🧁 response_codestr

The last response code as a string, or undef.


πŸ”₯ response_headers

The last response headers β€” a hashref of HTTP headers β€” or undef.


πŸ‘‘ response_content

The last response content, or undef. This is the same thing that the last get/post returns, so it's giving "same energy, different door" 🫢


πŸ’€ BUGS πŸ’€

Not intended for use in mission-critical applications.

like. bestie. read that again. this is NOT the thing you put in prod at 3am. the docs said what they said 😭🚨


🌈 AUTHORS 🌈

Mikhael Goikhman (migo@homemail.com--Perl-GPL/arch-perl--devel). πŸ’–


⭐ SEE ALSO ⭐

For more information, see LWP, LWP::Simple. those are your other girls, go say hi πŸ¦‹


okay that's the whole page, you ate that reading session πŸ’…πŸ’– this was perl v5.20.2, dated 2005-03-25 β€” vintage, but she still serves. mwah, bye bestie! πŸŽ€βœ¨

πŸ“¦ where this page comes from