In perl.git, the branch maint-5.10 has been updated

<http://perl5.git.perl.org/perl.git/commitdiff/5e77bb7db9a6a6cc94221f48a43233c1c52709e6?hp=867dc45802c58d6e22e6953bf1039176a7481d53>

- Log -----------------------------------------------------------------
commit 5e77bb7db9a6a6cc94221f48a43233c1c52709e6
Author: Nicholas Clark <[email protected]>
Date:   Thu Jun 25 13:57:57 2009 +0100

    Upgrade to File::Path 2.07_03
    
    (cherry picked from commit 839bc55ad61e73319e7d4ae40fd6ece8ff36b147)

M       lib/File/Path.pm
M       lib/File/Path.t

commit 7ff6b638536fb6363c3eb46bd8440baa159e112e
Author: Nicholas Clark <[email protected]>
Date:   Thu Jun 25 13:41:02 2009 +0100

    As Errno is formally no longer dual-lived, give it a proper version number.
    
    (cherry picked from commit 27abe0f1948a5723ae5e7a612239579a589bf012)

M       ext/Errno/Errno_pm.PL

commit b81e8b861fa4ebc03bfb44cc1500c66bb630366f
Author: Rafael Garcia-Suarez <[email protected]>
Date:   Wed Jun 24 23:35:46 2009 +0200

    Add tests for smart match overload fallback
    
    (cherry picked from commit 6fbc735babe3525c434fade70a47efafacad5188)

M       t/op/smartmatch.t

commit 8e6268c0720b76462c381bfa3d985104cfeb7b60
Author: Nicholas Clark <[email protected]>
Date:   Wed Jun 24 17:20:15 2009 +0100

    Mention parallel testing in INSTALL and perl5110delta.pod
    
    (cherry-picked from commit 5ee651a9b9216a117835eca06b01232a8e3ac4a1,
    but with using the 5101 perdelta, rather than 5110)

M       INSTALL
M       pod/perl5101delta.pod

commit a761df3b49042519fab66efe689281d093116c86
Author: Nicholas Clark <[email protected]>
Date:   Wed Jun 24 17:12:44 2009 +0100

    Fix some typos and grammar infelicities in core test descriptions.
    
    (cherry picked from commit d4fb20eeed318cff99eaef543a3b681c9edb05aa)

M       MANIFEST

commit 23dcb68db38daad4ab93b369bc73df711b14dec9
Author: David Mitchell <[email protected]>
Date:   Wed Jun 24 13:38:27 2009 +0100

    core-cpan-diff: include author path in distro version comparison
    and display.
    (Also show module names being processed when using -o)
    
    (cherry picked from commit f0ce33d74d4adc7a8b004fe6b4266de0f326c253)

M       Porting/core-cpan-diff

commit 7f67f27f51f5c8f9b9de8d1ed5ea485186d73565
Author: David Mitchell <[email protected]>
Date:   Wed Jun 24 13:03:12 2009 +0100

    core-cpan-diff: continue with next distro on download failure
    
    (cherry picked from commit 8c814d1a540c5a07adc0648dc9d2b879bab3d772)

M       Porting/core-cpan-diff

commit 021e082209c5332fe629890b0e08ed2fdeefb5f9
Author: Nicholas Clark <[email protected]>
Date:   Tue Jun 23 23:01:41 2009 +0100

    Note that the "Deep recursion" depth warning threshold can be changed from 
100.
    
    (cherry picked from commit aad1d01f8120094381e88346b64f3558d2c6e66b)

M       pod/perldiag.pod

commit c426c5bd8757779da71b0c548feb809594fcac5b
Author: Nicholas Clark <[email protected]>
Date:   Tue Jun 23 22:46:23 2009 +0100

    When writing a perldelta, choose either "regex" or "regexp", and stick to 
it.
    
    (cherry picked from commit f337e9820d63f3c977ef7cc7f581b09d9f2a6e2c)

M       Porting/how_to_write_a_perldelta.pod

commit b5013e5653eb9dfb2440236bb4b856a878b684c3
Author: karl williamson <[email protected]>
Date:   Fri Jun 26 12:14:28 2009 -0600

    PATCH small documentation change for UCD.pm
    
    From 47005e45e9738044f28ea250c17120bfa04a09b1 Mon Sep 17 00:00:00 2001
    From: Karl Williamson <k...@khw-desktop.(none)>
    Date: Fri, 26 Jun 2009 12:11:05 -0600
    Subject: [PATCH] Small documentation change
    
    Signed-off-by: H.Merijn Brand <[email protected]>
    
    (cherry picked from commit 956cae9a39d38cbf579796dfaf373bdc31552184)

M       lib/Unicode/UCD.pm

commit c6f48259e237874f7a49d15a87e9bd55ba979971
Author: Vincent Pit <[email protected]>
Date:   Thu Jun 25 20:49:49 2009 +0200

    Update RExC_npar and after_freeze correctly after the first branch of a (?| 
... )
    
    This fixes RT #59734 : Segfault when using (?|) in regexp.
    
    (cherry-picked from commit ee91d26e067c78d37242b4b2ccf3d5d8d3c85b5f)

M       regcomp.c
M       t/op/re_tests
-----------------------------------------------------------------------

Summary of changes:
 INSTALL                              |   12 ++++++++
 MANIFEST                             |    6 ++--
 Porting/core-cpan-diff               |   49 ++++++++++++++++++---------------
 Porting/how_to_write_a_perldelta.pod |    3 +-
 ext/Errno/Errno_pm.PL                |    2 +-
 lib/File/Path.pm                     |   20 ++++++++++---
 lib/File/Path.t                      |   24 ++++++++++++++---
 lib/Unicode/UCD.pm                   |    6 +++-
 pod/perl5101delta.pod                |   14 +++++++++
 pod/perldiag.pod                     |    3 ++
 regcomp.c                            |    7 +++++
 t/op/re_tests                        |    5 +++
 t/op/smartmatch.t                    |   33 +++++++++++++++++++++-
 13 files changed, 145 insertions(+), 39 deletions(-)

diff --git a/INSTALL b/INSTALL
index c85b304..d278bd7 100644
--- a/INSTALL
+++ b/INSTALL
@@ -1945,6 +1945,18 @@ about the various security aspects of temporary files.
 
 =back
 
+The core distribution can now run its regression tests in parallel on
+Unix-like platforms. Instead of running C<make test>, set C<TEST_JOBS> in
+your environment to the number of tests to run in parallel, and run
+C<make test_harness>. On a Bourne-like shell, this can be done as
+
+    TEST_JOBS=3 make test_harness  # Run 3 tests in parallel
+
+An environment variable is used, rather than parallel make itself, because
+L<TAP::Harness> needs to be able to schedule individual non-conflicting test
+scripts itself, and there is no standard interface to C<make> utilities to
+interact with their job schedulers.
+
 =head1 make install
 
 This will put perl into the public directory you specified to
diff --git a/MANIFEST b/MANIFEST
index 97c0dd9..a548195 100755
--- a/MANIFEST
+++ b/MANIFEST
@@ -3892,7 +3892,7 @@ t/comp/parser.t                   See if the parser works 
in edge cases
 t/comp/proto.t                 See if function prototypes work
 t/comp/redef.t                 See if we get correct warnings on redefined subs
 t/comp/require.t               See if require works
-t/comp/retainedlines.t         See if the debugger can retains eval's lines
+t/comp/retainedlines.t         See if the debugger can retain eval's lines
 t/comp/script.t                        See if script invocation works
 t/comp/term.t                  See if more terms work
 t/comp/uproto.t                        See if the _ prototype works
@@ -3915,7 +3915,7 @@ t/io/openpid.t                    See if open works for 
subprocesses
 t/io/open.t                    See if open works
 t/io/perlio_fail.t             See if bad layers fail
 t/io/perlio_leaks.t            See if PerlIO layers are leaking
-t/io/perlio_open.t             See if PerlIO certain special opens work
+t/io/perlio_open.t             See if certain special forms of open work
 t/io/perlio.t                  See if PerlIO works
 t/io/pipe.t                    See if secure pipes work
 t/io/print.t                   See if print commands work
@@ -4216,7 +4216,7 @@ t/op/reg_mesg.t                   See if one can get 
regular expression errors
 t/op/reg_namedcapture.t                Make sure glob assignment doesn't break 
named capture
 t/op/reg_nc_tie.t              Test the tied methods of Tie::Hash::NamedCapture
 t/op/reg_pmod.t                        See if regexp /p modifier works as 
expected
-t/op/reg_posixcc.t             See if posix characterclasses behave 
consistantly
+t/op/reg_posixcc.t             See if posix character classes behave 
consistantly
 t/op/reg_unsafe.t              Check for unsafe match vars
 t/op/repeat.t                  See if x operator works
 t/op/reset.t                   See if reset operator works
diff --git a/Porting/core-cpan-diff b/Porting/core-cpan-diff
index 80d6b7d..1b38a94 100755
--- a/Porting/core-cpan-diff
+++ b/Porting/core-cpan-diff
@@ -141,11 +141,11 @@ sub run {
     my $outfh;
     if (defined $output_file) {
        open $outfh, '>', $output_file
-           or die "ERROR: could not open file '$output_file' for writing: $!";
+           or die "ERROR: could not open file '$output_file' for writing: 
$!\n";
     }
     else {
        open $outfh, ">&STDOUT"
-                           or die "ERROR: can't dup STDOUT: $!";
+                           or die "ERROR: can't dup STDOUT: $!\n";
     }
 
     if (defined $cache_dir) {
@@ -156,7 +156,7 @@ sub run {
        do_crosscheck($outfh, $cache_dir, $force, \...@modules);
     }
     else {
-       do_compare(\...@modules, $outfh, $cache_dir, $verbose, $use_diff,
+       do_compare(\...@modules, $outfh, $output_file, $cache_dir, $verbose, 
$use_diff,
            $reverse, $diff_opts);
     }
 }
@@ -166,7 +166,7 @@ sub run {
 # compare a list of modules against their CPAN equivalents
 
 sub do_compare {
-    my ($modules, $outfh, $cache_dir, $verbose,
+    my ($modules, $outfh, $output_file, $cache_dir, $verbose,
                $use_diff, $reverse, $diff_opts) = @_;
 
 
@@ -190,6 +190,7 @@ sub do_compare {
 
     my %seen_dist;
     for my $module (@$modules) {
+       warn "Processing $module ...\n" if defined $output_file;
        print $outfh "\n$module\n" unless $use_diff;
 
        my $m = $Maintainers::Modules{$module} 
@@ -208,8 +209,15 @@ sub do_compare {
        }
        $seen_dist{$dist}++;
 
-       my $cpan_dir = get_distribution($cache_dir, $untar_dir, $module, $dist);
-
+       my $cpan_dir;
+       eval {
+           $cpan_dir = get_distribution($cache_dir, $untar_dir, $module, $dist)
+       };
+       if ($@) {
+           print $outfh "  ", $@;
+           print $outfh "  (skipping)\n";
+           next;
+       }
 
        my @perl_files = Maintainers::get_module_files($module);
 
@@ -356,12 +364,13 @@ sub do_crosscheck {
            warn "WARNING: $file:$.: line doesn't have three fields 
(skipping)\n";
            next;
        }
-       $modules{$f[0]} = $f[2];
-
        my $distro = $f[2];
-       $distro =~ s{^.*/}{};
+       $distro =~ s{^[A-Z]/[A-Z]{2}/}{}; # strip leading A/AB/
+       $modules{$f[0]} = $distro;
 
-       $distros{distro_base($distro)}{$distro} = 1;
+       (my $short_distro = $distro) =~ s{^.*/}{};
+
+       $distros{distro_base($short_distro)}{$distro} = 1;
     }
 
     for my $module (@$modules) {
@@ -373,23 +382,19 @@ sub do_crosscheck {
            next;
        }
 
-
-       # given an try like
+       # given an entry like
        #   Foo::Bar 1.23 foo-bar-1.23.tar.gz,
        # first compare the module name against Foo::Bar, and failing that,
        # against foo-bar
 
        my $pdist = $m->{DISTRIBUTION};
        die "ERROR: $module has no DISTRIBUTION entry\n" unless defined $pdist;
-       $pdist =~ s{^.*/}{};
 
        my $cdist = $modules{$module};
+       (my $short_pdist = $pdist) =~ s{^.*/}{};
 
-       if (defined $cdist) {
-           $cdist =~ s{^.*/}{};
-       }
-       else {
-           my $d = $distros{distro_base($pdist)};
+       unless (defined $cdist) {
+           my $d = $distros{distro_base($short_pdist)};
            unless (defined $d) {
                print $outfh "\n$module: Can't determine current CPAN entry\n";
                next;
@@ -520,7 +525,7 @@ sub get_distribution {
     my ($cache_dir, $untar_dir, $module, $dist) = @_;
 
     $dist =~ m{.+/([^/]+)$}
-       or die "ERROR: $module: invalid DISTRIBUTION name (no AUTHOR/ prefix): 
$dist";
+       or die "ERROR: $module: invalid DISTRIBUTION name (no AUTHOR/ prefix): 
$dist\n";
     my $filename = $1;
 
     my $download_dir = $cache_dir || File::Temp::tempdir( CLEANUP => 1 );
@@ -536,18 +541,18 @@ sub get_distribution {
     unless (-f $download_file) {
        # not cached
        $dist =~ /^([A-Z])([A-Z])/
-           or die "ERROR: $module: invalid DISTRIBUTION name (not 
/^[A-Z]{2}/): $dist";
+           or die "ERROR: $module: invalid DISTRIBUTION name (not 
/^[A-Z]{2}/): $dist\n";
 
        my $url = "http://www.cpan.org/modules/by-authors/id/$1/$1$2/$dist";;
        my_getstore($url, $download_file)
-           or die "ERROR: Could not fetch '$url'";
+           or die "ERROR: Could not fetch '$url'\n";
     }
 
     # extract distribution
 
     my $ae = Archive::Extract->new( archive => $download_file);
     $ae->extract( to => $untar_dir )
-       or die "ERROR: failed to extract distribution '$download_file to temp. 
dir: " . $ae->error();
+       or die "ERROR: failed to extract distribution '$download_file to temp. 
dir: " . $ae->error() . "\n";
 
     # get the name of the extracted distribution dir
 
diff --git a/Porting/how_to_write_a_perldelta.pod 
b/Porting/how_to_write_a_perldelta.pod
index 1d21b92..115c689 100644
--- a/Porting/how_to_write_a_perldelta.pod
+++ b/Porting/how_to_write_a_perldelta.pod
@@ -49,7 +49,8 @@ C<Debian bug #379463>
 Be consistent.
 
 In a list, either make every item a note, or a full sentence. Either end
-every item with a full stop, or ensure that no item ends with one.
+every item with a full stop, or ensure that no item ends with one. I<regex>
+B<xor> I<regexp> - choose exactly one, and stick to it.
 
 =head2 Sections
 
diff --git a/ext/Errno/Errno_pm.PL b/ext/Errno/Errno_pm.PL
index dc8eaba..124b8fc 100644
--- a/ext/Errno/Errno_pm.PL
+++ b/ext/Errno/Errno_pm.PL
@@ -2,7 +2,7 @@ use ExtUtils::MakeMaker;
 use Config;
 use strict;
 
-our $VERSION = "1.10_01";
+our $VERSION = "1.11";
 
 my %err = ();
 my %wsa = ();
diff --git a/lib/File/Path.pm b/lib/File/Path.pm
index 7b687cd..e31191f 100644
--- a/lib/File/Path.pm
+++ b/lib/File/Path.pm
@@ -17,7 +17,7 @@ BEGIN {
 
 use Exporter ();
 use vars qw($VERSION @ISA @EXPORT @EXPORT_OK);
-$VERSION   = '2.07_02';
+$VERSION   = '2.07_03';
 @ISA       = qw(Exporter);
 @EXPORT    = qw(mkpath rmtree);
 @EXPORT_OK = qw(make_path remove_tree);
@@ -29,6 +29,10 @@ my $Is_MacOS   = $^O eq 'MacOS';
 # write permission to:
 my $Force_Writeable = grep {$^O eq $_} qw(amigaos dos epoc MSWin32 MacOS os2);
 
+# Unix-like systems need to stat each directory in order to detect
+# race condition. MS-Windows is immune to this particular attack.
+my $Need_Stat_Check = !($^O eq 'MSWin32');
+
 sub _carp {
     require Carp;
     goto &Carp::carp;
@@ -242,6 +246,7 @@ sub _rmtree {
 
         if ( -d _ ) {
             $root = VMS::Filespec::pathify($root) if $Is_VMS;
+
             if (!chdir($root)) {
                 # see if we can escalate privileges to get in
                 # (e.g. funny protection mask such as -w- instead of rwx)
@@ -262,8 +267,10 @@ sub _rmtree {
                 next ROOT_DIR;
             };
 
-            ($ldev eq $cur_dev and $lino eq $cur_inode)
-                or _croak("directory $canon changed before chdir, expected 
dev=$ldev ino=$lino, actual dev=$cur_dev ino=$cur_inode, aborting.");
+            if ($Need_Stat_Check) {
+                ($ldev eq $cur_dev and $lino eq $cur_inode)
+                    or _croak("directory $canon changed before chdir, expected 
dev=$ldev ino=$lino, actual dev=$cur_dev ino=$cur_inode, aborting.");
+            }
 
             $perm &= 07777; # don't forget setuid, setgid, sticky bits
             my $nperm = $perm | 0700;
@@ -304,6 +311,7 @@ sub _rmtree {
                 @files = map {$_ eq '.' ? '.;' : $_} reverse @files;
                 ($root = VMS::Filespec::unixify($root)) =~ s/\.dir\z//;
             }
+
             @files = grep {$_ ne $updir and $_ ne $curdir} @files;
 
             if (@files) {
@@ -330,8 +338,10 @@ sub _rmtree {
             ($cur_dev, $cur_inode) = (stat $curdir)[0,1]
                 or _croak("cannot stat prior working directory $arg->{cwd}: 
$!, aborting.");
 
-            ($arg->{device} eq $cur_dev and $arg->{inode} eq $cur_inode)
-                or _croak("previous directory $arg->{cwd} changed before 
entering $canon, expected dev=$ldev ino=$lino, actual dev=$cur_dev 
ino=$cur_inode, aborting.");
+            if ($Need_Stat_Check) {
+                ($arg->{device} eq $cur_dev and $arg->{inode} eq $cur_inode)
+                    or _croak("previous directory $arg->{cwd} changed before 
entering $canon, expected dev=$ldev ino=$lino, actual dev=$cur_dev 
ino=$cur_inode, aborting.");
+            }
 
             if ($arg->{depth} or !$arg->{keep_root}) {
                 if ($arg->{safe} &&
diff --git a/lib/File/Path.t b/lib/File/Path.t
index 3ecd8f6..319c3d0 100644
--- a/lib/File/Path.t
+++ b/lib/File/Path.t
@@ -2,7 +2,7 @@
 
 use strict;
 
-use Test::More tests => 120;
+use Test::More tests => 121;
 use Config;
 
 BEGIN {
@@ -303,6 +303,23 @@ else {
 }
 
 SKIP: {
+    skip "This is not a MSWin32 platform", 1
+        unless $^O eq 'MSWin32';
+
+    my $UNC_path_taint = $ENV{PERL_FILE_PATH_UNC_TESTDIR};
+    skip "PERL_FILE_PATH_UNC_TESTDIR environment variable not set", 1
+        unless defined($UNC_path_taint);
+
+    my ($UNC_path) = ($UNC_path_taint =~ m{^([/\\]{2}\w+[/\\]\w+[/\\]\w+)$});
+    
+    skip "PERL_FILE_PATH_UNC_TESTDIR environment variable does not point to a 
directory", 1
+        unless -d $UNC_path;
+    
+    my $removed = rmtree($UNC_path);
+    cmp_ok($removed, '>', 0, "removed $removed entries from $UNC_path");
+}
+
+SKIP: {
     # test bug http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=487319
     skip "Don't need Force_Writeable semantics on $^O", 4
         if grep {$^O eq $_} qw(amigaos dos epoc MSWin32 MacOS os2);
@@ -453,8 +470,7 @@ cannot remove directory for [^:]+: .* at \1 line \2
 cannot unlink file for [^:]+: .* at \1 line \2
 cannot restore permissions to \d+ for [^:]+: .* at \1 line \2
 cannot make child directory read-write-exec for [^:]+: .* at \1 line \2
-cannot remove directory for [^:]+: .* at \1 line \2
-cannot restore permissions to \d+ for [^:]+: .* at \1 line \2},
+cannot remove directory for [^:]+: .* at \1 line \2},
             'rmtree with insufficient privileges'
         );
     }
@@ -529,7 +545,7 @@ SKIP: {
         unless -d catdir(qw(EXTRA 1));
 
     rmtree 'EXTRA', {safe => 0, error => \$error};
-    is( scalar(@$error), 11, 'seven deadly sins' ); # well there used to be 7
+    is( scalar(@$error), 10, 'seven deadly sins' ); # well there used to be 7
 
     rmtree 'EXTRA', {safe => 1, error => \$error};
     is( scalar(@$error), 9, 'safe is better' );
diff --git a/lib/Unicode/UCD.pm b/lib/Unicode/UCD.pm
index c2cd67b..c6ee8e0 100644
--- a/lib/Unicode/UCD.pm
+++ b/lib/Unicode/UCD.pm
@@ -31,6 +31,9 @@ Unicode::UCD - Unicode character database
     use Unicode::UCD 'charinfo';
     my $charinfo   = charinfo($codepoint);
 
+    use Unicode::UCD 'casefold';
+    my $casefold = casefold(0xFB00);
+
     use Unicode::UCD 'casespec';
     my $casespec = casespec(0xFB00);
 
@@ -1110,7 +1113,8 @@ sub casespec {
 If used with a single argument in a scalar context, returns the string
 consisting of the code points of the named sequence, or B<undef> if no
 named sequence by that name exists.  If used with a single argument in
-a list context, it returns the list of the code points.  If used with no
+a list context, it returns the list of the ordinals of the code points.  If 
used
+with no
 arguments in a list context, returns a hash with the names of the
 named sequences as the keys and the named sequences as strings as
 the values.  Otherwise, it returns B<undef> or an empty list depending
diff --git a/pod/perl5101delta.pod b/pod/perl5101delta.pod
index a37cdda..b406322 100644
--- a/pod/perl5101delta.pod
+++ b/pod/perl5101delta.pod
@@ -183,6 +183,20 @@ more information.
 This pragma allows you to lexically disable or enable overloading
 for some or all operations. (Yuval Kogman)
 
+=head2 Parallel tests
+
+The core distribution can now run its regression tests in parallel on
+Unix-like platforms. Instead of running C<make test>, set C<TEST_JOBS> in
+your environment to the number of tests to run in parallel, and run
+C<make test_harness>. On a Bourne-like shell, this can be done as
+
+    TEST_JOBS=3 make test_harness  # Run 3 tests in parallel
+
+An environment variable is used, rather than parallel make itself, because
+L<TAP::Harness> needs to be able to schedule individual non-conflicting test
+scripts itself, and there is no standard interface to C<make> utilities to
+interact with their job schedulers.
+
 XXX do we now have dtrace?
 
 =head1 Modules and Pragmata
diff --git a/pod/perldiag.pod b/pod/perldiag.pod
index 2822d50..6c950bd 100644
--- a/pod/perldiag.pod
+++ b/pod/perldiag.pod
@@ -1417,6 +1417,9 @@ L<perlfunc/pack>.
 infinite recursion, unless you're writing strange benchmark programs, in
 which case it indicates something else.
 
+This threshold can be changed from 100, by recompiling the F<perl> binary,
+setting the C pre-processor macro C<PERL_SUB_DEPTH_WARN> to the desired value.
+
 =item defined(@array) is deprecated
 
 (D deprecated) defined() is not usually useful on arrays because it
diff --git a/regcomp.c b/regcomp.c
index 299f925..ccbe982 100644
--- a/regcomp.c
+++ b/regcomp.c
@@ -6119,6 +6119,13 @@ S_reg(pTHX_ RExC_state_t *pRExC_state, I32 paren, I32 
*flagp,U32 depth)
     /* Pick up the branches, linking them together. */
     parse_start = RExC_parse;   /* MJD */
     br = regbranch(pRExC_state, &flags, 1,depth+1);
+
+    if (freeze_paren) {
+        if (RExC_npar > after_freeze)
+            after_freeze = RExC_npar;
+        RExC_npar = freeze_paren;
+    }
+
     /*     branch_len = (paren != 0); */
 
     if (br == NULL)
diff --git a/t/op/re_tests b/t/op/re_tests
index f9b070d..f65b6b9 100644
--- a/t/op/re_tests
+++ b/t/op/re_tests
@@ -1294,6 +1294,11 @@ X(\w+)(?=\s)|X(\w+)      Xab     y       [$1-$2] [-ab]
 (?|(?|(a)|(b))|(?|(c)|(d)))    c       y       $1      c
 (?|(?|(a)|(b))|(?|(c)|(d)))    d       y       $1      d
 (.)(?|(.)(.)x|(.)d)(.) abcde   y       $1-$2-$3-$4-$5- b-c--e--
+(?|(?<foo>x))  x       y       $+{foo} x
+(?|(?<foo>x)|(?<bar>y))        x       y       $+{foo} x
+(?|(?<bar>y)|(?<foo>x))        x       y       $+{foo} x
+(?<bar>)(?|(?<foo>x))  x       y       $+{foo} x
+
 #Bug #41492
 (?(DEFINE)(?<A>(?&B)+)(?<B>a))(?&A)    a       y       $&      a
 (?(DEFINE)(?<A>(?&B)+)(?<B>a))(?&A)    aa      y       $&      aa
diff --git a/t/op/smartmatch.t b/t/op/smartmatch.t
index 9df7357..58466af 100644
--- a/t/op/smartmatch.t
+++ b/t/op/smartmatch.t
@@ -35,8 +35,14 @@ tie my %tied_hash, 'Tie::StdHash';
 }
 
 {
+    package Test::Object::StringOverload;
+    use overload '""' => sub { "object" }, fallback => 1;
+    sub new { bless { key => 1 } }
+}
+
+{
     package Test::Object::WithOverload;
-    sub new { bless { key => 'magic' } }
+    sub new { bless { key => ($_[1] // 'magic') } }
     use overload '~~' => sub {
        my %hash = %{ $_[0] };
        if ($_[2]) { # arguments reversed ?
@@ -51,7 +57,9 @@ tie my %tied_hash, 'Tie::StdHash';
 }
 
 our $ov_obj = Test::Object::WithOverload->new;
+our $ov_obj_2 = Test::Object::WithOverload->new("object");
 our $obj = Test::Object::NoOverload->new;
+our $str_obj = Test::Object::StringOverload->new;
 
 tie my %refh, 'Tie::RefHash';
 $refh{$ov_obj} = 1;
@@ -62,7 +70,7 @@ my %keyandmore = map { $_ => 0 } @keyandmore;
 my %fooormore = map { $_ => 0 } @fooormore;
 
 # Load and run the tests
-plan tests => 294;
+plan tests => 314;
 
 while (<DATA>) {
     next if /^#/ || !/\S/;
@@ -192,11 +200,32 @@ __DATA__
 @      "key"           $obj
 @      FALSE           $obj
 
+# regular object with "" overload
+@      $obj            $str_obj
+=@     \&fatal         $str_obj
+@      \&FALSE         $str_obj
+@      \&foo           $str_obj
+@      sub { 1 }       $str_obj
+@      sub { 0 }       $str_obj
+@      %keyandmore     $str_obj
+@      {"object" => 1} $str_obj
+@      @fooormore      $str_obj
+@      ["object" => 1] $str_obj
+@      /object/        $str_obj
+@      qr/object/      $str_obj
+@      "object"        $str_obj
+@      FALSE           $str_obj
+# Those will treat the $str_obj as a string because of fallback:
+!      $ov_obj         $str_obj
+       $ov_obj_2       $str_obj
+
 # object (overloaded or not) ~~ Any
        $obj            qr/NoOverload/
        $ov_obj         qr/^stringified$/
 =      "$ov_obj"       "stringified"
+=      "$str_obj"      "object"
 !=     $ov_obj         "stringified"
+       $str_obj        "object"
        $ov_obj         'magic'
 !      $ov_obj         'not magic'
 

--
Perl5 Master Repository

Reply via email to