X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2Fversion.pod;h=0f4f20d45eabd49c515f68287005d6088511b0b1;hb=e68ec53fb89aea41859fe8c109fe9b03a3599284;hp=509089cd12d6304b8f71b2220f1a4e4f5f853804;hpb=43eaf59d25f22137101201b9df220432655a6cc2;p=p5sagit%2Fp5-mst-13.2.git diff --git a/lib/version.pod b/lib/version.pod index 509089c..0f4f20d 100644 --- a/lib/version.pod +++ b/lib/version.pod @@ -55,13 +55,24 @@ and to not rely on hidden behavior of the parser. =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 @@ -250,6 +261,19 @@ must be quoted to be converted properly. For this reason, it is strongly recommended that all initializers to qv() be quoted strings instead of bare numbers. +To prevent the C function from being exported to the caller's namespace, +either use version with a null parameter: + + use version (); + +or just require version, like this: + + require version; + +Both methods will prevent the import() method from firing and exporting the +C sub. This is true of subclasses of version as well, see +L for details. + =back For the subsequent examples, the following three objects will be used: @@ -559,14 +583,10 @@ derived class: See also L on CPAN for an alternate representation of version strings. -B the L operator is not a class method and will not be inherited -in the same way as the other methods. L will always return an object of -type L and not an object in the derived class. If you need to -have L return an object in your derived class, add something like this: - - *::qv = sub { return bless version::qv(shift), __PACKAGE__ }; - -as seen in the test file F. +B Although the L operator is not a true class method, but rather a +function exported into the caller's namespace, a subclass of version will +inherit an import() function which will perform the correct magic on behalf +of the subclass. =head1 EXPORT