App::instopt - Download and install software
This document describes version 0.016 of App::instopt (from Perl distribution App-instopt), released on 2020-10-08.
See instopt script.
Usage:
cleanup_download_dir(%args) -> [status, msg, payload, meta]
Remove older versions of downloaded software.
This function is not exported.
This function supports dry-run operation.
Arguments ('*' denotes required arguments):
download_dir => dirname
install_dir => dirname
program_dir => dirname
Special arguments:
-dry_run => bool
Pass -dry_run=>1 to enable simulation mode.
Returns an enveloped result (an array).
First element (status) is an integer containing HTTP status code (200 means OK, 4xx caller error, 5xx function error). Second element (msg) is a string containing error message, or 'OK' if status is 200. Third element (payload) is optional, the actual result. Fourth element (meta) is called result metadata and is optional, a hash that contains extra information.
Return value: (any)
cleanup_install_dir(%args) -> [status, msg, payload, meta]
Remove inactive versions of installed software.
compare_versions(%args) -> [status, msg, payload, meta]
Compare installed vs downloaded vs latest versions of installed software.
download(%args) -> [status, msg, payload, meta]
Download latest version of one or more software.
arch => software::arch
softwares_or_patterns* => array[str]
download_all(%args) -> [status, msg, payload, meta]
Download latest version of all known software.
is_downloaded_any(%args) -> [status, msg, payload, meta]
Check if any version of a software is downloaded.
The download does not need to be the latest version. To check if the latest version of a software is downloaded, use is-downloaded-latest.
is-downloaded-latest
quiet => bool
software* => str
is_downloaded_latest(%args) -> [status, msg, payload, meta]
Check if latest version of a software has been downloaded.
To only check whether any version of a software has been downloaded, use is-downloaded-any.
is-downloaded-any
is_installed_any(%args) -> [status, msg, payload, meta]
Check if any version of a software is installed.
The installed version does not need to be the latest. To check whether the latest version of a software is installed, use is-installed-latest.
is-installed-latest
is_installed_latest(%args) -> [status, msg, payload, meta]
Check if latest version of a software is installed.
To only check whether any version of a software is installed, use is-installed-any.
is-installed-any
list(%args) -> [status, msg, payload, meta]
List software.
Examples:
List software that are installed but out-of-date:
list( installed => 1, latest_installed => 0);
Result:
[ 500, "Function died: Failed to change directory to '/home/u1/software': No such file or directory at lib/App/instopt.pm line 331.\n", undef, { logs => [ { file => "/home/u1/perl5/perlbrew/perls/perl-5.30.0/lib/site_perl/5.30.0/Perinci/Access/Schemeless.pm", func => "Perinci::Access::Schemeless::action_call", line => 494, package => "Perinci::Access::Schemeless", time => 1602119125, type => "create", }, ], }, ]
List software that have been downloaded but out-of-date:
list( downloaded => 1, latest_downloaded => 0); # -> [200, "OK", [], {}]
List software that have their latest version downloaded but not installed:
list( latest_downloaded => 1, latest_installed => 0); # -> [200, "OK", [], {}]
detail => true
downloaded => bool
If true, will only list downloaded software.
installed => bool
If true, will only list installed software.
latest_downloaded => bool
If true, will only list software which have their latest version downloaded.
If set to true, a software which is not downloaded, or downloaded but does not have the latest version downloaded, will not be included.
If set to false, a software which has no downloaded versions, or does not have the latest version downloaded, will be included.
latest_installed => bool
If true, will only list software which have their latest version installed.
If set to true, a software which is not installed, or installed but does not have the latest version installed, will not be included.
If set to false, a software which is not installed, or does not have the latest version installed, will be included.
list_downloaded(%args) -> [status, msg, payload, meta]
List all downloaded software.
list_downloaded_versions(%args) -> [status, msg, payload, meta]
List all downloaded versions of a software.
list_installed(%args) -> [status, msg, payload, meta]
List all installed software.
list_installed_versions(%args) -> [status, msg, payload, meta]
List all installed versions of a software.
update(%args) -> [status, msg, payload, meta]
Update a software to the latest version.
download => bool (default: 1)
Whether to download latest version from URLor just find from download dir.
update_all(%args) -> [status, msg, payload, meta]
Update all installed software.
Please visit the project's homepage at https://metacpan.org/release/App-instopt.
Source repository is at https://github.com/perlancar/perl-App-instopt.
Please report any bugs or feature requests on the bugtracker website https://rt.cpan.org/Public/Dist/Display.html?Name=App-instopt
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.
perlancar <perlancar@cpan.org>
This software is copyright (c) 2020, 2019, 2018 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.
To install App::instopt, copy and paste the appropriate command in to your terminal.
cpanm
cpanm App::instopt
CPAN shell
perl -MCPAN -e shell install App::instopt
For more information on module installation, please visit the detailed CPAN module installation guide.