GSP
Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Support
Contact Us
Online Help
Handbooks
Domain Status
Man Pages

FAQ
Virtual Servers
Pricing
Billing
Technical

Network
Facilities
Connectivity
Topology Map

Miscellaneous
Server Agreement
Year 2038
Credits
 

USA Flag

 

 

Man Pages
Test::Version(3) User Contributed Perl Documentation Test::Version(3)

Test::Version - Check to see that version's in modules are sane

version 2.09

  use Test::More;
  use Test::Version 1.001001 qw( version_all_ok ), {
      is_strict   => 0,
      has_version => 1,
      consistent  => 1,
    };

  # test blib or lib by default
  version_all_ok();

  done_testing;

This module's goal is to be a one stop shop for checking to see that your versions across your dist are sane. Please ensure that you use version 0.04 or later only, as earlier versions are old code and may not work correctly. Current feature list:
module has a version
Tests to insure that all modules checked have a VERSION defined, Can replace Test::HasVersion
module has a valid version
Tests to insure that all versions are valid, according to the rules of version method "is_lax". To quote:

The lax criteria corresponds to what is currently allowed by the version parser. All of the following formats are acceptable for dotted-decimal formats strings:

  v1.2
  1.2345.6
  v1.23_4
  1.2345
  1.2345_01
    

If you want to limit yourself to a much more narrow definition of what a version string constitutes, is_strict() is limited to version strings like the following list:

  v1.234.5
  2.3456
    

you can cause your tests to fail if not strict by setting is_strict to 1

  version_ok( $filename, [ $name ] );

Test a single ".pm" file by passing a path to the function. Checks if the module has a version, and that it is valid with "is_lax".

  version_all_ok( [ $directory, [ $name ]] );

Test all modules in a directory with "version_ok". By default it will check "blib" or "lib" if you haven't passed it a directory.

  use Test::Version qw( version_all_ok ), { has_version => 0 };

Allows disabling whether a module has to have a version. If set to 0 version tests will be skipped in any module where no version is found.

really doesn't make sense to use with just version_ok

  use Test::Version { is_strict => 1 };

this allows enabling of versions "is_strict" checks to ensure that your version is strict.

  use Test::Version { consistent => 1 };

Check if every module has the same version number.

  use Test::Version { ignore_unindexable => 0};

if you have at least Module::Metadata v1.000020 Test::Version will by default skip any files not considered is_indexable

  use Test::Version 2.0 { filename_match => [qr{Foo/Bar.pm$}] };

Only test files that match the given pattern. Pattern may be a list of strings, regular expressions or code references. The filename will match if it matches one or more patterns.

string
The file matches if it matches the pattern string exactly.
regular expression
The file matches if it matches the regular expression.
code reference
The file matches if the code reference returns a true value. The filename is passed in as the only argument to the code reference.

  use Test::Version 2.02 { multiple => 1 };

Test each version for each package if multiple packages are found in a file.

The goal is to have the functionality of all of these.
Test::HasVersion
Test::ConsistentVersion
Test::GreaterVersion

If you are using Dist::Zilla there is a plugin

Dist::Zilla::Plugin::Test::Version

Please report any bugs or feature requests on the bugtracker website <https://github.com/plicease/test-version/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.

  • Damyan Ivanov <dmn@debian.org>
  • Dave Rolsky <autarch@urth.org>
  • Gabor Szabo <gabor@szabgab.com>
  • Karen Etheridge <ether@cpan.org>
  • Michael G. Schwern <schwern@pobox.com>
  • Mike Doherty <doherty@cs.dal.ca>
  • particle <particle@cpan.org>

  • Graham Ollis <plicease@cpan.org>
  • Caleb Cushing <xenoterracide@gmail.com>

This software is Copyright (c) 2018 by Caleb Cushing.

This is free software, licensed under:

  The Artistic License 2.0 (GPL Compatible)
2018-04-25 perl v5.32.1

Search for    or go to Top of page |  Section 3 |  Main Index

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with ManDoc.