From 8b46c09ba8a3ae75055618a6e0bb4da2fac1b138 Mon Sep 17 00:00:00 2001 From: Father Chrysostomos Date: Thu, 8 Dec 2011 06:24:53 -0800 Subject: [PATCH] Deparse CORE::do+{} and CORE::do({}) correctly Commit 94bb57f91b missed the CORE:: variant. --- dist/B-Deparse/Deparse.pm | 2 +- dist/B-Deparse/t/deparse.t | 7 +++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/dist/B-Deparse/Deparse.pm b/dist/B-Deparse/Deparse.pm index c3ac5fa..2ca91f6 100644 --- a/dist/B-Deparse/Deparse.pm +++ b/dist/B-Deparse/Deparse.pm @@ -1770,7 +1770,7 @@ sub pp_sleep { maybe_targmy(@_, \&unop, "sleep") } sub pp_dofile { my $code = unop(@_, "do", 1); # llafr does not apply - if ($code =~ s/^do \{/do({/) { $code .= ')' } + if ($code =~ s/^((?:CORE::)?do) \{/$1({/) { $code .= ')' } $code; } sub pp_entereval { diff --git a/dist/B-Deparse/t/deparse.t b/dist/B-Deparse/t/deparse.t index 056c9cf..de7b764 100644 --- a/dist/B-Deparse/t/deparse.t +++ b/dist/B-Deparse/t/deparse.t @@ -837,9 +837,16 @@ print $_; # [perl #47361] do({}) and do +{} (variants of do-file) do({}); do +{}; +sub foo::do {} +package foo; +CORE::do({}); +CORE::do +{}; >>>> do({}); do({}); +package foo; +CORE::do({}); +CORE::do({}); #### # [perl #77096] functions that do not follow the llafr () = (return 1) + time; -- 2.7.4