develooper Front page | perl.perl5.porters | Postings from January 2004

Re: [perl #25268] h2xs does not create VERSION stubs

Tassilo von Parseval
January 28, 2004 22:04
Re: [perl #25268] h2xs does not create VERSION stubs
Message ID:
On Mon, Jan 26, 2004 at 06:59:55AM +0000 (via RT) wrote:

> This is a bug report for perl from,
> generated with the help of perlbug 1.33 running under perl v5.6.1.
> -----------------------------------------------------------------
> [Please enter your report here]
> nobody knows about the VERSION method except people who
> have thoroughly read perldoc -f use.  I believe that it
> would be a good thing if h2xs added a default VERSION
> method to the code it creates, and commented it out.  This
> commented-out code would have an obvious way to edit it in
> order to create a VERSION method that knows what lower version
> numbers the current version is incompatbile with.  
> Let's say the current version is 2.3.4 and the current version
> supports the same interface as everything from 1.0.0 to 2.2.3
> but then an incompatibility was introduced in 2.2.4 which was
> taken out in 2.3.1.  We would want to describe this situation
> by uncommenting the VERSION code and editing a configuration
> structure something like this:
>     {
> 	$VERSION_INCOMPATIBILITY{'[0.0.0,1.0.0)'} = 
> 		"constructor syntax has changed";
> 	$VERSION_INCOMPATIBILITY{'[2.2.4,2.3.1)'} = 
> 		"frobniz method croaks without second argument";
> 	sub VERSION{
> 		... not sure exactly what goes here,
> 		but it parses (keys %VERSION_INCOMPATIBILITY)
> 		comparing each to the provided parameter; 
> 		`perldoc -f use` is not clear on whether the
> 		desired version arrives in $_[0] or $_[1] ...
> 	}
>     }
> And the above would be commented out, along with instructions
> for using it, just like the discussion of %EXPORT_TAGS which
> now appears in h2xs-provided skeletons.

And which I immediately delete each time I create a new module. Using
h2xs' skeleton as an ersatz-documentation looks like abuse to me. 

A better documentation (or in fact any documentation) of the VERSION
method is probably better placed in perlnewmod.pod or perlmod.pod.

Interestingly, perlmod.pod is deliberately misleading the reader. It
gives this code as an example:

    $VERSION = do { my @r = (q$Revision: 2.21 $ =~ /\d+/g); 
                    sprintf "%d."."%02d" x $#r, @r };

This implies that versioning always happens through $VERSION whereas the
above could also be a candidate for an overridden VERSION() method.

$_=reverse,s+(?<=sub).+q#q!'"qq.\t$&."'!#+sexisexiixesixeseg;y~\n~~dddd;eval Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About