From: Dagfinn Ilmari Mannsåker <ilmari@ilmari.org>
To: Andrew Dunstan <andrew@dunslane.net>
Cc: John Naylor <john.naylor@enterprisedb.com>
Cc: Alvaro Herrera <alvherre@alvh.no-ip.org>
Cc: pgsql-committers@lists.postgresql.org
Subject: Re: pgsql: Fix perltidy breaking perlcritic
Date: Mon, 12 Sep 2022 10:54:47 +0100
Message-ID: <8735cwncig.fsf@wibble.ilmari.org> (raw)
In-Reply-To: <CAD5tBc+zRhuWn_S4ayH2sWKe60FQu1guTTokDFS3YMOeSrsozA@mail.gmail.com>
References: <E1oWDka-001ygS-TB@gemulon.postgresql.org>
<CAD5tBcLLAvZO_x9X0=NePodXJCMowC8ieBAa6t_a0SeUu+rrfA@mail.gmail.com>
<CAFBsxsG4yC4uUM6+fy=0RO0ZE6E=VRFJ6Eu6fBeairBUxtCunQ@mail.gmail.com>
<CAD5tBc+zRhuWn_S4ayH2sWKe60FQu1guTTokDFS3YMOeSrsozA@mail.gmail.com>
Andrew Dunstan <andrew@dunslane.net> writes:
> On Fri, Sep 9, 2022 at 10:44 PM John Naylor <john.naylor@enterprisedb.com>
> wrote:
>
>> On Fri, Sep 9, 2022 at 3:32 AM Andrew Dunstan <andrew@dunslane.net> wrote:
>>
>> > A better way do do this IMNSHO is to put the eval in a block on its own
>> along with the no critic marker on its own line, like this:
>> >
>> > {
>> > ## no critic (ProhibitStringyEval)
>> > eval ...
>> > }
>> >
>> > perlcritic respects block boundaries for its directives.
>>
>> I tried that in the attached -- it looks a bit nicer but requires more
>> explanation. I don't have strong feelings either way.
>>
>>
> Maybe even better would be just this, which I bet perltidy would not monkey
> with, and would require no explanation:
>
> eval "\$hash_ref = $_"; ## no critic (ProhibitStringyEval)
I didn't see this until it got committed, since I'm not subscribed to
-committers, but I think it would be even better to rely on the fact
that eval returns the value of the last expression in the string, which
also gets rid of the ugly quoting and escaping, per the attached.
- ilmari
Attachments:
0001-Use-return-value-of-eval-instead-of-assigning-inside.patch (text/x-diff, 0B) download
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-committers@postgresql.org
Cc: ilmari@ilmari.org, andrew@dunslane.net, john.naylor@enterprisedb.com, alvherre@alvh.no-ip.org
Subject: Re: pgsql: Fix perltidy breaking perlcritic
In-Reply-To: <8735cwncig.fsf@wibble.ilmari.org>
References: <E1oWDka-001ygS-TB@gemulon.postgresql.org> <CAD5tBcLLAvZO_x9X0=NePodXJCMowC8ieBAa6t_a0SeUu+rrfA@mail.gmail.com> <CAFBsxsG4yC4uUM6+fy=0RO0ZE6E=VRFJ6Eu6fBeairBUxtCunQ@mail.gmail.com> <CAD5tBc+zRhuWn_S4ayH2sWKe60FQu1guTTokDFS3YMOeSrsozA@mail.gmail.com> <8735cwncig.fsf@wibble.ilmari.org>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox