NAME
Module::CheckLatestVersion - Warn/die when a module is not the latest version
VERSION
This document describes version 0.004 of Module::CheckLatestVersion (from Perl distribution Module-CheckLatestVersion), released on 2026-04-08.
SYNOPSIS
In Your/Module.pm:
package Your::Module;
use Module::CheckLatestVersion; # automatically exports 'check_latest_version'
our $VERSION = 1.23;
our $AUTHORITY = 'cpan:PERLANCAR';
check_latest_version();
# check_latest_version({die=>1});
If module is not the latest version (checked against authority) then a warn message is displayed. If the die option is set, program will die.
Or, alternatively, in your-script.pl:
#!perl
use strict;
use warnings;
use Module::CheckLatestVersion;
use Your::Module;
check_latest_version("Your::Module");
#check_latest_version({die=>1}, "Your::Module");
...
DESCRIPTION
This module can be used to check other module's version against latest version in authority. Authority can be CPAN or DarkPAN or other schemes that are supported by Module::CheckVersion.
Checking against authority is cached, by default 3600 seconds (default from Cache::File::Simple).
This can be used to ensure that scripts use the latest version of a module.
FUNCTIONS
check_latest_version
Usage:
check_latest_version([ \%opts, ] [ $mod ])
Check module $mod against authority (default is CPAN), using Module::CheckVersion. $mod defaults to the caller's package. If module is not the latest version, a warning is emitted.
When one of these environment variables are set, will skip checking (no-op): HARNESS_ACTIVE, RELEASE_TESTING, AUTOMATED_TESTING, PERL_MODULE_CHECKLATESTVERSION_SKIP.
Options:
die
Bool. If set to true, will die instead of warn.
ENVIRONMENT
PERL_MODULE_CHECKLATESTVERSION_OPT_DIE
Bool. Set default value for the die option.
PERL_MODULE_CHECKLATESTVERSION_SKIP
Bool. Can be set to true to skip checking.
HOMEPAGE
Please visit the project's homepage at https://metacpan.org/release/Module-CheckLatestVersion.
SOURCE
Source repository is at https://github.com/perlancar/perl-Module-CheckLatestVersion.
SEE ALSO
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) 2026 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=Module-CheckLatestVersion
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.