Front page | perl.perl5.porters |
Postings from December 2009
version syntax
Thread Next
From:
John Peacock
Date:
December 7, 2009 19:20
Subject:
version syntax
Message ID:
4B1DC5E5.5000409@havurah-software.org
I'm not where I wanted to be,[1] but I wanted to confirm that I was
still proceeding in the agreed-upon direction direction.
The following is a distillation of the regular expressions discussed
earlier. $STRICT and $LAX are actually package globals in the version::
namespace, so they can be referenced by any module choosing to use them.
=======================================
my $DECIMAL_VERSION = '
(?:
(?: # integer part
0| # 0 or
[1-9] # 1-9 followed by
[0-9]* # zero or more digits
) # mantissa required
# optionally followed by
(?: # decimal part
\. # literal decimal point
[0-9]+ # one or more digits
)? # optional
)';
my $DOTTED_DECIMAL_VERSION ='
(?:
v # leading v required
[0-9]+ # integer part
(?: # repeated part
\. # literal decimal point
[0-9]{1,3} # followed by one to three digits
){2,} # repeating 2 or more times
)';
my $ALPHA = '
(?:
(?:
_ # literal underscore
[0-9]+ # followed by one or more digits
)+ # one or more times
)';
$STRICT = qr/(?:${DECIMAL_VERSION}|${DOTTED_DECIMAL_VERSION)/;
$LAX = "${STRICT}${ALPHA}?";
$LAX =~ s/v/v?/; # make leading 'v' optional
$LAX =~ s/1,3/1,/; #remove 3 digit limit on dotted decimals
$LAX = qr/$LAX/;
=======================================
John
1) I can provide a patch now to create S_force_package_version, which
uses scan_version directly. I have not completed the work to make that
strict for 'package name version' and lax for 'use name version'.
Thread Next
-
version syntax
by John Peacock