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

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

From:
John Peacock
Date:
January 28, 2004 10:35
Subject:
Re: [perl #25268] h2xs does not create VERSION stubs
Message ID:
4017FBA1.6040403@rowman.com
I tried to send this yesterday, but my home machine cannot seem to contact the 
perl.org MX boxes. :~(

davidnico@cpan.org (via RT) wrote:

> 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.  


As the "official" VERSION maven, I'd appreciate it if this was _not_ the case.
I don't have any problem with any developer desiring a finer control overriding
the UNIVERSAL::VERSION with their own, but the thought of leading developers to
believe that they could safely do it on their own would be just dangerous.

>     {
> 	my %VERSION_INCOMPATIBILITY;
> 
> 	$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] ...
> 
> 	}
>     }
> 

I've already got most of the design and coding done for a module I am calling 
version::Limit (version::Incompatibility is too long to type ;~) based on my 
version module.  I need to finish the tests and complete the documentation.

For example (this code is working already):

> package LimitTest;
> use version::Limit;
> 
> version::Limit::Scope(
>         "[0.0.0,1.0.0)" => "constructor syntax has changed",
>         "[2.2.4,2.3.1)" => "frobniz method croaks without second argument",
> );
> our $VERSION = "3.2.5";

and then this works:

> perl -I lib -I t -e 'use LimitTest 0.1.0;'
> Cannot 'use LimitTest 0.1.0': constructor syntax has changed at lib/version/Limit.pm line 77.
> BEGIN failed--compilation aborted at -e line 1.

However, this module will be strictly limited to 5.8.0 and later Perl's, since 
it requires the enhanced v-string support only introduced in 5.8.0.

Contact me offline...

John

-- 
John Peacock
Director of Information Research and Technology
Rowman & Littlefield Publishing Group
4501 Forbes Boulevard
Suite H
Lanham, MD  20706
301-459-3366 x.5010
fax 301-429-5748




nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About