NAME
Test::Against::Dev::Sort - Sort Perl 5 development and RC releases in logical order
SYNOPSIS
use Test::Against::Dev::Sort;
my $minor_version = 27;
$self = Test::Against::Dev::Sort->new($minor_version);
my @versions = ( qw|
perl-5.27.10
perl-5.28.0-RC4
perl-5.27.0
perl-5.27.9
perl-5.28.0-RC1
perl-5.27.11
| );
my $sorted_versions_ref = $self->sort_dev_and_rc_versions(\@versions);
my $non_matches_ref = $self->get_non_matches();
$self->dump_non_matches();
DESCRIPTION
Given a list of strings representing Perl 5 releases in a specific development cycle, ...
perl-5.27.10
perl-5.28.0-RC4
perl-5.27.0
perl-5.27.9
perl-5.28.0-RC1
perl-5.27.11
... sort the list in logical order.
By specific development cycle is meant a series of development releases like perl-5.27.0
, perl-5.27.1
, ... perl-5.27.11
(or perhaps perl-5.27.12
) followed by RC (Release Candidate) releases beginning with perl-5.28.0-RC1
, perl-5.28.0-RC2
, ..., but not including production releases (perl-5.28.0
), maintenance releases (perl-5.28.1
) or RCs for maintainance releases (perl-5.28.1-RC1
).
By logical order is meant:
Development releases:
5.27.1 major version: 5 minor version: 27 patch version: 1
Have an odd minor version number greater than or equal to
7
.Have a one- or two-digit patch version number starting at
0
.
RC (Release Candidate) releases:
5.28.0-RC4 major version: 5 minor version: 28 patch version: 0 RC version: 4
Have a minor version number which is even and one greater than the dev version number.
Have a patch version number of
0
(as we are not concerned with maintenance releases).Have a string in the format
-RCx
following the patch version number, wherex
is a one-digit number starting with1
.
For the example above, the desired result would be:
perl-5.27.0
perl-5.27.9
perl-5.27.10
perl-5.27.11
perl-5.28.0-RC1
perl-5.28.0-RC4
METHODS
c<new()>
Purpose
Test::Against::Dev::Sort constructor.
Arguments
my $minor_version = 27; $self = Test::Against::Dev::Sort->new($minor_version);
Odd-numbered integer, >=
7
, representing the minor version for a Perl 5 monthly development release.Return Value
Test::Against::Dev::Sort object.
sort_dev_and_rc_versions()
Purpose
Arguments
my @versions = ( qw| perl-5.27.10 perl-5.28.0-RC4 perl-5.27.0 perl-5.27.9 perl-5.28.0-RC1 perl-5.27.11 | ); my $sorted_versions_ref = $self->sort_dev_and_rc_versions(\@versions);
Reference to an array holding a list of Perl version strings for development or RC releases for a single annual development cycle (as denoted by the minor version number passed to
new()
).Return Value
Reference to an array holding that list sorted in logical order (as defined above).
Comment
Any element in the arrayref passed as the argument which does not qualify is silently added to a list accessible via the
get_non_matches()
andget_dump_matches()
methods. =back
get_non_matches()
Purpose
Identify those elements of the arrayref passed to
sort_dev_and_rc_versions()
which do not qualify as being the Perl version string for a development or RC release in the annual development cycle passed as an argumentnew()
.Arguments
my $non_matches_ref = $self->get_non_matches();
None; all data needed is already inside the object.
Return Value
Reference to an array holding a list of elements in the arrayref passed to
sort_dev_and_rc_versions()
which do not qualify as being the Perl version string for a development or RC release in the annual development cycle passed as an argumentnew()
.Comment
Not meaningful except when called after
sort_dev_and_rc_versions()
.
dump_non_matches()
Purpose
Pretty-print to STDOUT the list returned by
get_non_matches()
.Arguments
my $non_matches_ref = $self->get_non_matches();
None; all data needed is already inside the object.
Return Value
Perl true value.
Comment
Not meaningful except when called after
sort_dev_and_rc_versions()
.