Pádraig Brady wrote: > Jim Meyering wrote: >> Pádraig Brady wrote: >>> Jim Meyering wrote: >>>> I've built and have been experimenting with perl 5.11.2+ >>>> and hit a little snag: bootstrap was unable to extract >>>> the version number from its new --version output. >>>> To address that, I've changed bootstrap to special-case perl: >>> That looks good, the caveat being that all projects >>> with specifications of perl in bootstrap.conf must be >>> updated to the new format. >>> >>> Note I just noticed there was an issue with the perl-5.5 dependency >>> specification in coreutils::bootstrap.conf as on perl 5.5.x >>> systems one would have got: >>> >>> Error: 'perl' version == 5.005 is too old >>> 'perl' version >= 5.5 is required >>> >>> One could also handle both of these issues with >>> this updated get_version(), the advantage being that >>> no bootstrap.conf files need to be updated. Also all >>> version specs would be of a consistent format. >> ... >>> #the following essentially does s/5.005/5.5/ >>> s/\.0*\([1-9]\)/.\1/g >> ... >> >> good catch! >> >> However, performing that substitution on a string like 5.010000 >> would give 5.10000. Not what we want. > > Note no `perl --version` I know outputs 5.005002, it outputs > 5.005_002 which will be truncated to 5.005 by our regex. > So in general we would just be treating the version as ints delimited with '.'
BTW, here's what 5.11.2 prints: $ perl --version |sed -n 2p This is perl 5, version 11, subversion 2 (v5.11.2-81-g162177c*) built for x86_64-linux >> Using $^V appears to be the solution: >> >> $ perl -le '($v = $^V) =~ s/^v//; print $v' >> 5.10.0 >> >> Generally, I prefer to avoid using $_, but here it might be worthwhile >> for the slight overall decrease in syntax: >> >> $ perl -le '$_ = $^V; s/^v//; print' >> >> Opinions? > > I looked at $^V first but was dissuaded as > I thought $^V was not available until perl 5.6? > Also I thought it changed format recently > (it doesn't work on 5.8 on solaris at least).