Change 33602 by [EMAIL PROTECTED] on 2008/03/30 00:53:42

        Sync feature.pm:
        
        Integrate:
        [ 32645]
        feature.pm needs to cope with the version not being 5.10.0
        
        [ 33247]
        Subject: [PATCH] feature bundles are the same across all subversions
        From: Steffen Mueller <[EMAIL PROTECTED]>
        Date: Sun, 13 Jan 2008 22:45:37 +0100
        Message-ID: <[EMAIL PROTECTED]>

Affected files ...

... //depot/maint-5.10/perl/MANIFEST#17 integrate
... //depot/maint-5.10/perl/lib/feature.pm#3 integrate
... //depot/maint-5.10/perl/t/lib/feature/bundle#1 branch

Differences ...

==== //depot/maint-5.10/perl/MANIFEST#17 (text) ====
Index: perl/MANIFEST
--- perl/MANIFEST#16~33574~     2008-03-26 09:37:45.000000000 -0700
+++ perl/MANIFEST       2008-03-29 17:53:42.000000000 -0700
@@ -3504,6 +3504,7 @@
 t/lib/dprof/test8_v            Perl code profiler tests
 t/lib/dprof/V.pm               Perl code profiler tests
 t/lib/Dummy.pm                 Module for testing base.pm
+t/lib/feature/bundle           Tests for feature bundles
 t/lib/feature/implicit         Tests for implicit loading of feature.pm
 t/lib/feature/nonesuch         Tests for enabling/disabling nonexistent feature
 t/lib/feature/say              Tests for enabling/disabling say feature

==== //depot/maint-5.10/perl/lib/feature.pm#3 (text) ====
Index: perl/lib/feature.pm
--- perl/lib/feature.pm#2~33122~        2008-01-30 03:24:19.000000000 -0800
+++ perl/lib/feature.pm 2008-03-29 17:53:42.000000000 -0700
@@ -1,6 +1,6 @@
 package feature;
 
-our $VERSION = '1.11';
+our $VERSION = '1.13';
 
 # (feature name) => (internal name, used in %^H)
 my %feature = (
@@ -12,13 +12,12 @@
 # NB. the latest bundle must be loaded by the -E switch (see toke.c)
 
 my %feature_bundle = (
-    "5.10.0" => [qw(switch say state)],
+    "5.10" => [qw(switch say state)],
+    "5.11" => [qw(switch say state)],
 );
 
-# latest version here
-$feature_bundle{"5.10"} = $feature_bundle{sprintf("%vd",$^V)};
-
-$feature_bundle{"5.9.5"} = $feature_bundle{"5.10.0"};
+# special case
+$feature_bundle{"5.9.5"} = $feature_bundle{"5.10"};
 
 # TODO:
 # - think about versioned features (use feature switch => 2)
@@ -101,11 +100,11 @@
 It's possible to load a whole slew of features in one go, using
 a I<feature bundle>. The name of a feature bundle is prefixed with
 a colon, to distinguish it from an actual feature. At present, the
-only feature bundles are C<use feature ":5.10"> and C<use feature ":5.10.0">,
-which both are equivalent to C<use feature qw(switch say state)>.
+only feature bundle is C<use feature ":5.10"> which is equivalent
+to C<use feature qw(switch say state)>.
 
-In the forthcoming 5.10.X perl releases, C<use feature ":5.10"> will be
-equivalent to the latest C<use feature ":5.10.X">.
+Specifying sub-versions such as the C<0> in C<5.10.0> in feature bundles has
+no effect: feature bundles are guaranteed to be the same for all sub-versions.
 
 =head1 IMPLICIT LOADING
 
@@ -128,9 +127,10 @@
 
 will do an implicit
 
-    use feature ':5.10.0';
+    use feature ':5.10';
 
-and so on.
+and so on. Note how the trailing sub-version is automatically stripped from the
+version.
 
 But to avoid portability warnings (see L<perlfunc/use>), you may prefer:
 
@@ -152,7 +152,10 @@
        if (substr($name, 0, 1) eq ":") {
            my $v = substr($name, 1);
            if (!exists $feature_bundle{$v}) {
-               unknown_feature_bundle($v);
+               $v =~ s/^([0-9]+)\.([0-9]+).[0-9]+$/$1.$2/;
+               if (!exists $feature_bundle{$v}) {
+                   unknown_feature_bundle(substr($name, 1));
+               }
            }
            unshift @_, @{$feature_bundle{$v}};
            next;
@@ -178,7 +181,10 @@
        if (substr($name, 0, 1) eq ":") {
            my $v = substr($name, 1);
            if (!exists $feature_bundle{$v}) {
-               unknown_feature_bundle($v);
+               $v =~ s/^([0-9]+)\.([0-9]+).[0-9]+$/$1.$2/;
+               if (!exists $feature_bundle{$v}) {
+                   unknown_feature_bundle(substr($name, 1));
+               }
            }
            unshift @_, @{$feature_bundle{$v}};
            next;

==== //depot/maint-5.10/perl/t/lib/feature/bundle#1 (text) ====
Index: perl/t/lib/feature/bundle
--- /dev/null   2008-03-18 12:45:05.529577733 -0700
+++ perl/t/lib/feature/bundle   2008-03-29 17:53:42.000000000 -0700
@@ -0,0 +1,50 @@
+Check feature bundles.
+
+__END__
+# Standard feature bundle
+use feature ":5.10";
+say "Hello", "world";
+EXPECT
+Helloworld
+########
+# more specific: 5.10.0 maps to 5.10
+use feature ":5.10.0";
+say "Hello", "world";
+EXPECT
+Helloworld
+########
+# as does 5.10.1
+use feature ":5.10.1";
+say "Hello", "world";
+EXPECT
+Helloworld
+########
+# as does 5.10.99
+use feature ":5.10.99";
+say "Hello", "world";
+EXPECT
+Helloworld
+########
+# 5.9.5 also supported
+use feature ":5.9.5";
+say "Hello", "world";
+EXPECT
+Helloworld
+########
+# 5.9 not supported
+use feature ":5.9";
+EXPECT
+OPTIONS regex
+^Feature bundle "5.9" is not supported by Perl \d+\.\d+\.\d+ at - line \d+
+########
+# 5.9.4 not supported
+use feature ":5.9.4";
+EXPECT
+OPTIONS regex
+^Feature bundle "5.9.4" is not supported by Perl \d+\.\d+\.\d+ at - line \d+
+########
+# 5.8.8 not supported
+use feature ":5.8.8";
+EXPECT
+OPTIONS regex
+^Feature bundle "5.8.8" is not supported by Perl \d+\.\d+\.\d+ at - line \d+
End of Patch.

Reply via email to