Beefy Boxes and Bandwidth Generously Provided by pair Networks
Come for the quick hacks, stay for the epiphanies.
 
PerlMonks  

Re: Three argument version of open '>-' (de-critic)

by LanX (Saint)
on Mar 02, 2021 at 02:16 UTC ( [id://11128977]=note: print w/replies, xml ) Need Help??


in reply to Three argument version of open '>-' (updated)

> Perl::Critic complains about it and wants us to replace it with a three argument variant. But, what's the 3-arg variant of >-?

From a pragmatic point of view, I'd say:

Adjust the Perl::Critic rule!

I mean it's an interesting question, but probably it's not possible to duplicate all these exact implementation details.

This particular 2 args syntax OTOH is documented and legit.

Cheers Rolf
(addicted to the Perl Programming Language :)
Wikisyntax for the Monastery

update

and by all communist gods, why would you like to have a duplicate of STDOUT which fails globally without warning?

Probably this feature is simply broken.

  • Comment on Re: Three argument version of open '>-' (de-critic)

Replies are listed 'Best First'.
Re^2: Three argument version of open '>-' (updated)
by jcb (Parson) on Mar 02, 2021 at 02:41 UTC

    Seconding this: Perl::Critic is simply wrong here. The primary risk of two-argument open is the possibility of a "strange" filename improperly triggering the magic (How about a "file" named 'rm -rf / |'?), but in this case the filename is a literal constant and that is not possible.

    This is a bug in Perl::Critic — your particular use of the two-argument syntax is fine.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://11128977]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others cooling their heels in the Monastery: (3)
As of 2024-04-21 03:00 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found