X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2Fversion.pm;h=1e3cabbb0d1664293d5957635ae475b0bab31686;hb=e0218a61b599e8e5c97718ac68ef92ad34b20839;hp=d2648d1c5950e701ed6f90898f583e1c5fd32ed0;hpb=9137345a080bfc646c2f9440cdb7bd90b8b37428;p=p5sagit%2Fp5-mst-13.2.git diff --git a/lib/version.pm b/lib/version.pm index d2648d1..1e3cabb 100644 --- a/lib/version.pm +++ b/lib/version.pm @@ -12,7 +12,7 @@ use vars qw(@ISA $VERSION $CLASS @EXPORT); @EXPORT = qw(qv); -$VERSION = "0.43"; +$VERSION = "0.47"; $CLASS = 'version'; @@ -152,7 +152,7 @@ purposes of comparison with other version objects. For example: $v = version->new( 1.002_03); # 1.2.30 See "Quoting" $v = version->new( 1.002003); # 1.2.3 -All of the preceeding examples except the second to last are true +All of the preceding examples except the second to last are true whether or not the input value is quoted. The important feature is that the input value contains only a single decimal. @@ -379,7 +379,7 @@ notation and stick with it, to reduce confusion. Perl6 version objects B only support numeric comparisons. See also L<"Quoting">. WARNING: Comparing version with unequal numbers of decimal places (whether -explicitely or implicitely initialized), may yield unexpected results at +explicitly or implicitly initialized), may yield unexpected results at first glance. For example, the following inequalities hold: version->new(0.96) > version->new(0.95); # 0.960.0 > 0.950.0 @@ -485,7 +485,7 @@ obeys the relationship Alpha versions with a single decimal place will be treated exactly as if they were L, for parsing purposes. The stringification for -alpha versions with a single decimal place may seem suprising, since any +alpha versions with a single decimal place may seem surprising, since any trailing zeros will visible. For example, the above $alphaver will print as 12.03_0100 @@ -538,6 +538,28 @@ will also exclusively return the numified form. Technically, the $module->VERSION function returns a string (PV) that can be converted to a number following the normal Perl rules, when used in a numeric context. +=head1 SUBCLASSING + +This module is specifically designed and tested to be easily subclassed. +In practice, you only need to override the methods you want to change, but +you have to take some care when overriding new() (since that is where all +of the parsing takes place). For example, this is a perfect acceptable +derived class: + + package myversion; + use base version; + sub new { + my($self,$n)=@_; + my $obj; + # perform any special input handling here + $obj = $self->SUPER::new($n); + # and/or add additional hash elements here + return $obj; + } + +See also L on CPAN for an alternate representation of +version strings. + =head1 EXPORT qv - quoted version initialization operator