NAME
    App::lcpan::Call - Check that local CPAN mirror exists and is fairly
    recent

VERSION
    This document describes version 0.120 of App::lcpan::Call (from Perl
    distribution App-lcpan-Call), released on 2021-07-21.

FUNCTIONS
  call_lcpan_script
    Usage:

     call_lcpan_script(%args) -> [$status_code, $reason, $payload, \%result_meta]

    "Call" lcpan script.

    This function is not exported by default, but exportable.

    Arguments ('*' denotes required arguments):

    *   argv => *array[str]* (default: [])

    *   max_age => *duration*

        Maximum index age (in seconds).

        If unspecified, will look at "LCPAN_MAX_AGE" environment variable.
        If that is also undefined, will default to 14 days.

    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)

  check_lcpan
    Usage:

     check_lcpan(%args) -> [$status_code, $reason, $payload, \%result_meta]

    Check that local CPAN mirror exists and is fairly recent.

    Will return status 200 if "lcpan" script is installed (available from
    PATH), local CPAN mirror exists, and is fairly recent and queryable.
    This routine will actually attempt to run "lcpan stats-last-index-time"
    and return the result if the result is 200 *and* the index is updated
    quite recently. By default "quite recently" is defined as not older than
    2 weeks or whatever LCPAN_MAX_AGE says (in seconds).

    This function is not exported by default, but exportable.

    Arguments ('*' denotes required arguments):

    *   max_age => *duration*

        Maximum index age (in seconds).

        If unspecified, will look at "LCPAN_MAX_AGE" environment variable.
        If that is also undefined, will default to 14 days.

    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)

ENVIRONMENT
  LCPAN_MAX_AGE => int
    Set the default of "max_age".

HOMEPAGE
    Please visit the project's homepage at
    <https://metacpan.org/release/App-lcpan-Call>.

SOURCE
    Source repository is at
    <https://github.com/perlancar/perl-App-lcpan-Call>.

BUGS
    Please report any bugs or feature requests on the bugtracker website
    <https://rt.cpan.org/Public/Dist/Display.html?Name=App-lcpan-Call>

    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.

AUTHOR
    perlancar <perlancar@cpan.org>

COPYRIGHT AND LICENSE
    This software is copyright (c) 2021, 2016, 2015 by 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.

