]> git.pld-linux.org Git - packages/rpm.git/blob - perl-heredoc-matching.patch
make -lib depend on elfutils-libs instead of elfutils; rel 7
[packages/rpm.git] / perl-heredoc-matching.patch
1 From 73419594af15e94e77bae413d9754d3775cf0280 Mon Sep 17 00:00:00 2001
2 From: Jan Palus <jpalus@fastmail.com>
3 Date: Tue, 12 Dec 2023 19:45:54 +0100
4 Subject: [PATCH] perl.req: make heredoc block matching more generic
5
6 match any <<MARKER providing:
7
8 - it is not in comment (not preceded by #)
9 - it can't be string literal (not preceded by ' or ")
10 - as a sanity check it must be preceded by either whitespace, comma or
11   equals sign
12
13 adds support for
14
15    return <<"EOS";
16
17    fun(arg, <<"EOS");
18 ---
19  scripts/perl.req | 6 +++---
20  1 file changed, 3 insertions(+), 3 deletions(-)
21
22 diff --git a/scripts/perl.req b/scripts/perl.req
23 index 1b50c50847..8bfa38771e 100755
24 --- a/scripts/perl.req
25 +++ b/scripts/perl.req
26 @@ -102,10 +102,10 @@ sub process_file {
27  
28    while (<FILE>) {
29  
30 -    # skip the "= <<" block
31 +    # skip the heredoc block
32  
33 -    if (m/^\s*(?:my\s*)?\$(?:.*)\s*=\s*<<\s*(["'`])(.+?)\1/ ||
34 -        m/^\s*(?:my\s*)?\$(.*)\s*=\s*<<(\w+)\s*;/) {
35 +    if (m/^[^'"#]+[\s,=(]<<\s*(["'`])(.+?)\1/ ||
36 +        m/^[^'"#]+[\s,=(](<<)(\w+)\s*;/) {
37        $tag = $2;
38        while (<FILE>) {
39          chomp;
This page took 0.033463 seconds and 3 git commands to generate.