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

Re: New release ?

Thread Previous | Thread Next
From:
kane
Date:
January 8, 2007 03:15
Subject:
Re: New release ?
Message ID:
20070108111517.GJ65581@xs4all.nl
On Sun, Jan 07, 2007 at 03:56:25PM -0500, John Peacock wrote:
> kane@xs4all.nl wrote:
> > This is mostly because qv() isn't a builtin or the 'use version'
> > statement is not on the same line. 
> 
> Unfortunately, people don't understand that the entire phrase
> 
> 	use version; $VERSION = qv("1.2.3");
> 
> is *all* required (the 'use' on the same line and passing qv() a string).  If I
> had a way (short of a sourcefilter) to make qv() act like a built-in (for
> tokenizer purposes), I would use it.

That'd be wonderful, I'm sure. Unfortunately, we're stuck with at least
older perls where this is not an option. Supporting version.pm in the
most easy crossplatform, cross-perl way possible is the next best thing
IMHO.

> > However, version.pm is an XS module, so bootstrapping it is kind of
> > hard. It has a pureperl compoment, but that one relies on Scalar::Util
> > to be installed[2], which again is XS code. 
> 
> I have a [possibly dodgy] way of replacing that code: check to see
> 
> 1) if the Perl version is >= 5.6.0 AND
> 2) it doesn't contain a decimal AND
> 3) if the source string sprint'd with "%vd" is 3 integers.
> 
> If all three are true, we can assume we have a v-string.  I already do this in
> the new(), so I can just replicate that code (or rather abstract it out) and use
> it in qv() as well.  

That sounds like a great solution to me. If it wouldn't be too hard to
implement, I'd like to see this in the next version.pm release :)

> The trickier thing is to figure out how to do without
> Scalar::Util::reftype() in _verify().

Well, there's a few good bits of news here. From what i see from the
code, you only care if the object is a hash ref with an array ref in a
certain slot. You could verify this as such:

    $ perl -le'$x=\0;eval{keys %$x}; warn $@ if $@; eval{scalar @$x}; \
        warn $@ if $@'
    Not a HASH reference at -e line 1.
    Not an ARRAY reference at -e line 1.

Ie, by just wrapping it in an eval. Alternately, the reftype() code of
Scalar::Util is pure perl, so you could even inline it.

> > Also, version.pm does not declare this as a prerequisite, 
> 
> You're right; that was sloppy of me.  If I don't strip it out completely, I'll
> have to figure out how to create a conditional dependency on Scalar::Util.

Your Makefile.PL already contains the line:

    PREREQ_PM       => \%prereq,
  
Simply add Scalar::Util to this hash if you're building pure-perl. Which
would fail in an environment without a c compiler of course :)

> > and ideally the rather mean Makefile.PL as well, 
> 
> What's wrong with my Makefile.PL??? ;-)  I am still highly biased towards the
> Build.PL, since it is so much nicer to do more complicated things, but I'm
> resigned to providing a standalone Makefile.PL for the unenlightened ones.  Tell
> me how the provided Makefile.PL is deficient (or provide a new one), and I'll
> include it...

It's a bit of a hackish way of determining C-support, and the
non-standard options it accepts (well, what's standard anyway?). This is
probably the least important bit tbh, and I'm probably being overly
sensitive.

Hopefully this will allow you to make the needed changes to make
version::vpp pure perl indeed. If not, don't hesitate to ask!

Thanks,

Jos

Thread Previous | Thread Next


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