Re: version-0.77 and You - Part 2

John Peacock <[email protected]>
Newsgroups gmane.comp.lang.perl.modules.module-build,gmane.comp.lang.perl.perl5.porters
Message-ID <[email protected]>
On 7/25/09 1:52 AM, Dave Mitchell wrote:
> In general we try strongly to avoid making code that works suddenly start
> emitting warnings under later releases of the same maintenance branch.
>
> However, I don't understand what the particular issue of using v-strings
> to initialize version objects is?
>
>    
use version;
$v1 = version->new(v1.2.3); # silent
$v2 = version->new(2.3.4); # warn(v-string without leading 'v' 
deprecated for version object)

For bleadperl, I believe Nicolas would like this to be the case:

$any1 = v34.23.45; # silent
$any2 = 45.32.57; # warn(v-string without leading 'v' deprecated)
> But whatever, I really don't want a new warning for 5.10.1 at this very
> late stage in the game.
>
>    
None of the third-party modules in the core changed their warning 
profile between 5.10.0 and 5.10.1-to-be?  I fully support not making the 
bare v-string code warn except in blead and hence for 5.12.0.  I'd 
really rather keep the warning in version.pm just the same.

However, it is your call completely - I just added the warning to 
bleadperl (but didn't update any tests).  Outside of the version.pm 
tests, there was only a single warning from t/pod/diag.t and a couple of 
warnings seen from the Module::Build tests (which would also have to be 
adjusted since it depends on version.pm and expectations have changed).

I'm traveling today, so I can do whatever needs doing when I get home 
tonight.  I'd prefer to apply this change:

diff --git a/util.c b/util.c
index 0d524e9..f088e73 100644
--- a/util.c
+++ b/util.c
@@ -4260,8 +4260,12 @@ Perl_scan_version(pTHX_ const char *s, SV *rv, 
bool qv)
      if ( alpha && saw_period && width == 0 )
         Perl_croak(aTHX_ "Invalid version format (misplaced _ in number)");

-    if ( saw_period > 1 )
+    if ( saw_period > 1 && qv == 0) {
         qv = 1; /* force quoted version processing */
+       if(ckWARN(WARN_SYNTAX))
+           Perl_warner(aTHX_ packWARN(WARN_SYNTAX),
+           "v-string without leading 'v' deprecated for version objects");
+    }

      last = pos;
      pos = s;

plus the test fixups to blead and then have that go into maint.  If you 
aren't comfortable with that, I'll just update just the POD and you can 
pull that.  I'm inclined to make an immediate CPAN release after 0.77 
(to match what is in 5.10.1) to include that warning, however, because I 
agree with David Golden that the clarity it provides is valuable...

John
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.