develooper Front page | perl.perl5.porters | Postings from September 2012

Very small patch to make constant.pm work again on 5.8

Thread Next
From:
=?iso-8859-1?Q?S=E9bastien_Aperghis-Tramoni?=
Date:
September 3, 2012 08:17
Subject:
Very small patch to make constant.pm work again on 5.8
Message ID:
9460944F-10DF-43A1-9CC2-096439EDDFBB@cpan.org
Hello all,


Before releasing the version of constant.pm from bleadperl to the CPAN, I tested it with the versions of Perl I have by hand, and it appears that the current code fails to compile on 5.8:

  Bareword "_DOWNGRADE" not allowed while "strict subs" in use at lib/constant.pm line 142.

This was added by this commit
  ┬╗ http://perl5.git.perl.org/perl.git/commitdiff/bd8cb5529605f33aa9cf95d6c471386b3a0e015d

Removing the short-circuit return allows the code to compile and the tests to pass on all stable Perl from 5.8.2 to 5.16.1:

--- dist/constant/lib/constant.pm	2011-10-08 14:54:47.000000000 +0200
+++ dist/constant/lib/constant.pm	2012-09-03 17:01:26.000000000 +0200
@@ -32,7 +32,6 @@
 
     # Before this makes its way into a dev perl release, we have to do
     # browser-sniffing, as it were....
-    return unless $const;
     *{chr 256} = \3;
     if (exists ${__PACKAGE__."::"}{"\xc4\x80"}) {
 	delete ${__PACKAGE__."::"}{"\xc4\x80"};
@@ -130,7 +129,7 @@
 	    if ($multiple || @_ == 1) {
 		my $scalar = $multiple ? $constants->{$name} : $_[0];
 
-		if (_DOWNGRADE) { # for 5.10 to 5.14
+		if (_DOWNGRADE) { # for 5.8 to 5.14
 		    # Work around perl bug #31991: Sub names (actually glob
 		    # names in general) ignore the UTF8 flag. So we have to
 		    # turn it off to get the "right" symbol table entry.


-- 
S├ębastien Aperghis-Tramoni

Close the world, txEn eht nepO.


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