NAME
App::HTTPTinyUtils - Command-line utilities related to HTTP::Tiny
VERSION
This document describes version 0.010 of App::HTTPTinyUtils (from Perl distribution App-HTTPTinyUtils), released on 2024-12-09.
SYNOPSIS
DESCRIPTION
This distribution includes several utilities related to HTTP::Tiny:
- 1. http-tiny
- 2. http-tiny-cache
- 3. http-tiny-customretry
- 4. http-tiny-plugin
- 5. http-tiny-plugin-every
- 6. http-tiny-retry
- 7. http-tinyish
FUNCTIONS
http_tiny
Usage:
http_tiny(%args) -> [$status_code, $reason, $payload, \%result_meta]
Perform request(s) with HTTP::Tiny.
This function is not exported.
Arguments ('*' denotes required arguments):
attributes => hash
Pass attributes to HTTP::Tiny constructor.
content => str
(No description)
headers => hash
(No description)
ignore_errors => bool
Ignore errors.
Normally, when given multiple URLs, the utility will exit after the first non-success response. With
ignore_errors
set to true, will just log the error and continue. Will return with the last error response.method => str (default: "GET")
(No description)
raw => bool
(No description)
urls* => array[str]
(No description)
Returns an enveloped result (an array).
First element ($status_code) is an integer containing HTTP-like status code (200 means OK, 4xx caller error, 5xx function error). Second element ($reason) is a string containing error message, or something like "OK" if status is 200. Third element ($payload) is the actual result, but usually not present when enveloped result is an error response ($status_code is not 2xx). Fourth element (%result_meta) is called result metadata and is optional, a hash that contains extra information, much like how HTTP response headers provide additional metadata.
Return value: (any)
http_tiny_cache
Usage:
http_tiny_cache(%args) -> [$status_code, $reason, $payload, \%result_meta]
Perform request(s) with HTTP::Tiny::Cache.
Like http_tiny
, but uses HTTP::Tiny::Cache instead of HTTP::Tiny. See the documentation of HTTP::Tiny::Cache on how to set cache period.
This function is not exported.
Arguments ('*' denotes required arguments):
attributes => hash
Pass attributes to HTTP::Tiny constructor.
content => str
(No description)
headers => hash
(No description)
ignore_errors => bool
Ignore errors.
Normally, when given multiple URLs, the utility will exit after the first non-success response. With
ignore_errors
set to true, will just log the error and continue. Will return with the last error response.method => str (default: "GET")
(No description)
raw => bool
(No description)
urls* => array[str]
(No description)
Returns an enveloped result (an array).
First element ($status_code) is an integer containing HTTP-like status code (200 means OK, 4xx caller error, 5xx function error). Second element ($reason) is a string containing error message, or something like "OK" if status is 200. Third element ($payload) is the actual result, but usually not present when enveloped result is an error response ($status_code is not 2xx). Fourth element (%result_meta) is called result metadata and is optional, a hash that contains extra information, much like how HTTP response headers provide additional metadata.
Return value: (any)
http_tiny_customretry
Usage:
http_tiny_customretry(%args) -> [$status_code, $reason, $payload, \%result_meta]
Perform request(s) with HTTP::Tiny::CustomRetry.
Like http_tiny
, but uses HTTP::Tiny::CustomRetry instead of HTTP::Tiny. See the documentation of HTTP::Tiny::CustomRetry for more details.
This function is not exported.
Arguments ('*' denotes required arguments):
attributes => hash
Pass attributes to HTTP::Tiny constructor.
content => str
(No description)
headers => hash
(No description)
ignore_errors => bool
Ignore errors.
Normally, when given multiple URLs, the utility will exit after the first non-success response. With
ignore_errors
set to true, will just log the error and continue. Will return with the last error response.method => str (default: "GET")
(No description)
raw => bool
(No description)
urls* => array[str]
(No description)
Returns an enveloped result (an array).
First element ($status_code) is an integer containing HTTP-like status code (200 means OK, 4xx caller error, 5xx function error). Second element ($reason) is a string containing error message, or something like "OK" if status is 200. Third element ($payload) is the actual result, but usually not present when enveloped result is an error response ($status_code is not 2xx). Fourth element (%result_meta) is called result metadata and is optional, a hash that contains extra information, much like how HTTP response headers provide additional metadata.
Return value: (any)
http_tiny_plugin
Usage:
http_tiny_plugin(%args) -> [$status_code, $reason, $payload, \%result_meta]
Perform request(s) with HTTP::Tiny::Plugin.
Like http_tiny
, but uses HTTP::Tiny::Plugin instead of HTTP::Tiny. See the documentation of HTTP::Tiny::Plugin for more details.
This function is not exported.
Arguments ('*' denotes required arguments):
attributes => hash
Pass attributes to HTTP::Tiny constructor.
content => str
(No description)
headers => hash
(No description)
ignore_errors => bool
Ignore errors.
Normally, when given multiple URLs, the utility will exit after the first non-success response. With
ignore_errors
set to true, will just log the error and continue. Will return with the last error response.method => str (default: "GET")
(No description)
raw => bool
(No description)
urls* => array[str]
(No description)
Returns an enveloped result (an array).
First element ($status_code) is an integer containing HTTP-like status code (200 means OK, 4xx caller error, 5xx function error). Second element ($reason) is a string containing error message, or something like "OK" if status is 200. Third element ($payload) is the actual result, but usually not present when enveloped result is an error response ($status_code is not 2xx). Fourth element (%result_meta) is called result metadata and is optional, a hash that contains extra information, much like how HTTP response headers provide additional metadata.
Return value: (any)
http_tiny_plugin_every
Usage:
http_tiny_plugin_every(%args) -> [$status_code, $reason, $payload, \%result_meta]
Perform request(s) with HTTP::Tiny::Plugin every N seconds, log result in a directory.
Like http_tiny_plugin
, but perform the request every N seconds and log the result in a directory.
This function is not exported.
Arguments ('*' denotes required arguments):
attributes => hash
Pass attributes to HTTP::Tiny constructor.
content => str
(No description)
dir* => dirname
(No description)
every* => duration
(No description)
headers => hash
(No description)
ignore_errors => bool
Ignore errors.
Normally, when given multiple URLs, the utility will exit after the first non-success response. With
ignore_errors
set to true, will just log the error and continue. Will return with the last error response.method => str (default: "GET")
(No description)
raw => bool
(No description)
urls* => array[str]
(No description)
Returns an enveloped result (an array).
First element ($status_code) is an integer containing HTTP-like status code (200 means OK, 4xx caller error, 5xx function error). Second element ($reason) is a string containing error message, or something like "OK" if status is 200. Third element ($payload) is the actual result, but usually not present when enveloped result is an error response ($status_code is not 2xx). Fourth element (%result_meta) is called result metadata and is optional, a hash that contains extra information, much like how HTTP response headers provide additional metadata.
Return value: (any)
http_tiny_retry
Usage:
http_tiny_retry(%args) -> [$status_code, $reason, $payload, \%result_meta]
Perform request(s) with HTTP::Tiny::Retry.
Like http_tiny
, but uses HTTP::Tiny::Retry instead of HTTP::Tiny. See the documentation of HTTP::Tiny::Retry for more details.
This function is not exported.
Arguments ('*' denotes required arguments):
attributes => hash
Pass attributes to HTTP::Tiny constructor.
content => str
(No description)
headers => hash
(No description)
ignore_errors => bool
Ignore errors.
Normally, when given multiple URLs, the utility will exit after the first non-success response. With
ignore_errors
set to true, will just log the error and continue. Will return with the last error response.method => str (default: "GET")
(No description)
raw => bool
(No description)
urls* => array[str]
(No description)
Returns an enveloped result (an array).
First element ($status_code) is an integer containing HTTP-like status code (200 means OK, 4xx caller error, 5xx function error). Second element ($reason) is a string containing error message, or something like "OK" if status is 200. Third element ($payload) is the actual result, but usually not present when enveloped result is an error response ($status_code is not 2xx). Fourth element (%result_meta) is called result metadata and is optional, a hash that contains extra information, much like how HTTP response headers provide additional metadata.
Return value: (any)
http_tinyish
Usage:
http_tinyish(%args) -> [$status_code, $reason, $payload, \%result_meta]
Perform request(s) with HTTP::Tinyish.
Like http_tiny
, but uses HTTP::Tinyish instead of HTTP::Tiny. See the documentation of HTTP::Tinyish for more details.
Observes HTTP_TINYISH_PREFERRED_BACKEND
to set $HTTP::Tinyish::PreferredBackend
. For example:
% HTTP_TINYISH_PREFERRED_BACKEND=HTTP::Tinyish::Curl http-tinyish https://foo/
This function is not exported.
Arguments ('*' denotes required arguments):
attributes => hash
Pass attributes to HTTP::Tiny constructor.
content => str
(No description)
headers => hash
(No description)
ignore_errors => bool
Ignore errors.
Normally, when given multiple URLs, the utility will exit after the first non-success response. With
ignore_errors
set to true, will just log the error and continue. Will return with the last error response.method => str (default: "GET")
(No description)
raw => bool
(No description)
urls* => array[str]
(No description)
Returns an enveloped result (an array).
First element ($status_code) is an integer containing HTTP-like status code (200 means OK, 4xx caller error, 5xx function error). Second element ($reason) is a string containing error message, or something like "OK" if status is 200. Third element ($payload) is the actual result, but usually not present when enveloped result is an error response ($status_code is not 2xx). Fourth element (%result_meta) is called result metadata and is optional, a hash that contains extra information, much like how HTTP response headers provide additional metadata.
Return value: (any)
HOMEPAGE
Please visit the project's homepage at https://metacpan.org/release/App-HTTPTinyUtils.
SOURCE
Source repository is at https://github.com/perlancar/perl-App-HTTPTinyUtils.
AUTHOR
perlancar <perlancar@cpan.org>
CONTRIBUTING
To contribute, you can send patches by email/via RT, or send pull requests on GitHub.
Most of the time, you don't need to build the distribution yourself. You can simply modify the code, then test via:
% prove -l
If you want to build the distribution (e.g. to try to install it locally on your system), you can install Dist::Zilla, Dist::Zilla::PluginBundle::Author::PERLANCAR, Pod::Weaver::PluginBundle::Author::PERLANCAR, and sometimes one or two other Dist::Zilla- and/or Pod::Weaver plugins. Any additional steps required beyond that are considered a bug and can be reported to me.
COPYRIGHT AND LICENSE
This software is copyright (c) 2024 by perlancar <perlancar@cpan.org>.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.
BUGS
Please report any bugs or feature requests on the bugtracker website https://rt.cpan.org/Public/Dist/Display.html?Name=App-HTTPTinyUtils
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.