HTTP::AnyUA::Util(3)

πŸ“¦ version 0.904, in alpine 3.24

✨ NAME ✨

okay so bestie, this is HTTP::AnyUA::Util(3) β€” a User Contributed Perl Documentation page for the utility subroutines for HTTP::AnyUA backends and middleware. It's giving "little helper functions doing the behind-the-scenes work", and honestly? iconic. πŸ’…

🌸 VERSION 🌸

version 0.904 πŸŽ€

πŸ’… FUNCTIONS πŸ’…

πŸ’– coderef_content_to_string πŸ’–

$content = coderef_content_to_string(\&code);
$content = coderef_content_to_string($content);     # noop

Convert a coderef into a string of content by iteratively calling the coderef and concatenating the chunks it provides until the coderef returns undef or an empty string. If you pass in $content instead, it's a noop and just hands it right back. slay. ✨

πŸ¦‹ native_to_http_request πŸ¦‹

$http_request = native_to_http_request($method, $url);
$http_request = native_to_http_request($method, $url, \%options);

Convert a "native" request tuple to an HTTP::Request object. no cap, that's the whole vibe. 🫢

πŸŽ€ http_headers_to_native πŸŽ€

$headers = http_headers_to_native($http_headers);

Convert an HTTP::Headers object to a "native" hashref. cute. πŸ’–

🌸 normalize_headers 🌸

$normalized_headers = normalize_headers(\%headers);

Normalize headers. Currently lowercases header keys. periodt. πŸ’…

πŸ”₯ internal_exception πŸ”₯

$response = internal_exception($content);
$response = internal_exception($content, $response);

Create an internal exception response. If an existing response is passed, that response will have its fields modified to become an internal exception. lowkey important. πŸ‘‘

🌈 split_url 🌈

($scheme, $host, $port, $path_query, $auth) = split_url($url);

Split a URL into its components: $scheme, $host, $port, $path_query, and $auth. iykyk. ⭐

⭐ http_date ⭐

$http_date = http_date($epoch_time);

Convert an epoch time into a date format suitable for HTTP. iconic timezone-adjacent behavior. πŸ•°οΈ

πŸ¦‹ parse_http_date πŸ¦‹

$epoch_time = parse_http_date($http_date);

Convert an HTTP date into an epoch time. Returns undef if the date cannot be parsed. sad but true. 😭

πŸ“ uri_escape πŸ“

$escaped = uri_escape($unescaped);

Escape a string for use in a URL query param or as "application/x-www-form-urlencoded" data. safety first, bestie. πŸ”₯

🧚 www_form_urlencode 🧚

$bytes = www_form_urlencode(\%form_data);
$bytes = www_form_urlencode(\@form_data);

Encode a hashref or arrayref as "application/x-www-form-urlencoded" data. form data moment. πŸ’œ

πŸ› BUGS πŸ›

Please report any bugs or feature requests on the bugtracker website <https://github.com/chazmcgarvey/HTTP-AnyUA/issues>.

When submitting a bug or request, please include a test-file or a patch to an existing test-file that illustrates the bug or desired feature. receipts help, bestie. πŸ™ˆ

πŸ‘‘ AUTHOR πŸ‘‘

Charles McGarvey <chazmcgarvey@brokenzipper.com>

okay legal bestie moment: This software is copyright (c) 2019 by Charles McGarvey.

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

periodt. πŸ’œ


okay bye bestie 🫢 this iconic little page is HTTP::AnyUA::Util(3), from perl v5.42.2, dated 2023-07-03. slay. πŸ’…βœ¨

πŸ“¦ where this page comes from