The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

TITLE

version_regex - Lift and mung version::regex regexen

SYNOPSIS

 version_regex
 version_regex -help
 version_regex -version

OPTIONS

-dump

If this Boolean option is asserted, the output is a Data::Dumper dump of the regexp.

-help

This option displays the documentation for this script. The script then exits.

-strict

If this Boolean option is asserted, the output is constant STRICT__VERSION rather than LAX_VERSION, and is based on $version::regex::STRICT.

The default is -nostrict

-version

This option displays the version of this script. The script then exits.

DETAILS

This unsupported Perl script loads version::regex, serializes $version::regex::LAX, modifies it to suit, and generates code to include it into Test2::Tools::LoadModule.

Caveat: version::regex is undocumented, and does not come with older versions of version. So this script represents major mucking around with the internals of another module. Be warned.

The only modification needed to the underlying regex is to remove the leading undef | . But under any modern Perl, serialization introduces the notation '(?^:...), which requires at least Perl 5.13.6. Because /x is the only modifier used, I was able to

    s/ \? \^ : /?-x:/smxg;
    s/ \? \^ x: /?x:/smxg;
    s/ \? : /?-x:/smxg;

to get the intended effect.

AUTHOR

Thomas R. Wyant, III wyant at cpan dot org

COPYRIGHT AND LICENSE

Copyright (C) 2020 by Thomas R. Wyant, III

This program is free software; you can redistribute it and/or modify it under the same terms as Perl 5.10.0. For more details, see the full text of the licenses in the directory LICENSES.

This program is distributed in the hope that it will be useful, but without any warranty; without even the implied warranty of merchantability or fitness for a particular purpose.