@EXPORT = qw(qv);
-$VERSION = 0.50;
+$VERSION = 0.52;
$CLASS = 'version';
=item * Be careful
If you are using Module::Build or ExtUtils::MakeMaker, so that you can
-release your module to CPAN, you have to recognize that none of those
-programs currently handles version objects natively (yet). That also
-goes for the CPAN indexer (PAUSE). Although there are modules on CPAN
-that employ the version module internally, the support for assigning a
-module $VERSION scalar is still lacking. Both Module::Build and the
-PAUSE indexer will [hopefully soon] include support for version
-objects.
+release your module to CPAN, you have to recognize that neither of those
+programs completely handles version objects natively (yet). If you use
+version objects with Module::Build, you should add an explicit dependency
+to the release of version.pm in your Build.PL:
+
+ my $builder = Module::Build->new(
+ ...
+ requires => {
+ ... ,
+ 'version' => 0.50,
+ ...,
+ },
+ ...
+ );
+
+and it should Just Work(TM). Module::Build will [hopefully soon]
+include full support for version objects; there are no current plans
+to patch ExtUtils::MakeMaker to support version objects.
=head2 What IS a version
#########################
-use Test::More tests => 202;
+use Test::More qw(no_plan);
diag "Tests with base class" unless $ENV{PERL_CORE};
like($@, qr/underscores before decimal/,
"Invalid version format (underscores before decimal)");
+ eval {my $version = $CLASS->new("1_2")};
+ like($@, qr/alpha without decimal/,
+ "Invalid version format (alpha without decimal)");
+
$version = $CLASS->new("99 and 44/100 pure");
ok ("$version" eq "99.000", '$version eq "99.000"');
ok ($version->numify == 99.0, '$version->numify == 99.0');
*/
if (sv_derived_from(vecsv, "version")) {
char *version = savesvpv(vecsv);
+ if ( hv_exists((HV*)SvRV(vecsv), "alpha", 5 ) ) {
+ Perl_warner(aTHX_ packWARN(WARN_INTERNAL),
+ "vector argument not supported with alpha versions");
+ goto unknown;
+ }
vecsv = sv_newmortal();
/* scan_vstring is expected to be called during
* tokenization, so we need to fake up the end
@INC = '../lib';
}
use warnings;
+use version;
use Config;
use strict;
>%vd< >"\01\02\03"< >1.2.3<
>%vd< >v1.2.3< >1.2.3<
>%vd< >[version::qv("1.2.3")]< >1.2.3<
->%vd< >[version::qv("1.2")]< >1.2.0<
->%vd< >[version::qv("1.02")]< >1.2.0<
->%vd< >[version::qv("1.002")]< >1.2.0<
->%vd< >[version::qv("1.02_03")]< >1.23<
->%vd< >[version::qv("1048576.5")]< >1048576.5.0<
->%vd< >[version::qv("50")]< >50.0.0<
->%vd< >[version::qv("50_20")]< >50.200<
->%vd< >[version::qv("5.005_03")]< >5.53<
+>%vd< >[version->new("1.2")]< >1.200<
+>%vd< >[version->new("1.02")]< >1.20<
+>%vd< >[version->new("1.002")]< >1.2<
+>%vd< >[version->new("1048576.5")]< >1048576.500<
+>%vd< >[version->new("50")]< >50.0<
>%v.3d< >"\01\02\03"< >001.002.003<
>%0v3d< >"\01\02\03"< >001.002.003<
>%v.3d< >[version::qv("1.2.3")]< >001.002.003<
pos++;
}
+ if ( alpha && !saw_period )
+ Perl_croak(aTHX_ "Invalid version format (alpha without decimal)");
+
if ( saw_period > 1 )
qv = 1; /* force quoted version processing */