PerlPowerTools icon indicating copy to clipboard operation
PerlPowerTools copied to clipboard

Use three-argument open

Open briandfoy opened this issue 6 years ago • 2 comments
trafficstars

Many of the open-for-reading file handles didn't use three-argument open:

https://kritika.io/users/briandfoy/repos/7253941177493998/snapshots/1/violations?limit=20&page=1&rule=InputOutput%3A%3AProhibitTwoArgOpen

For example:

open FOO, $filename;

Add the default read mode in the middle:

open FOO, '<', $filename;

If you feel like it, change those to lexical file handles, although that's a much bigger change that you might not want to drag into this issue.

Do as many or as few of the problem files as you like. For Hacktoberfest, it doesn't matter how big or complete the pull request is. :)

briandfoy avatar Oct 20 '19 07:10 briandfoy

I'm going to have a go at this issue

IvanLudvig avatar Oct 20 '19 12:10 IvanLudvig

I fixed up a few things, and took care of most of the rest of them in e8d09609c3b3e23ba234600feb1cbbb92241c9e8.

I have a list of files that I still need to test in f33bdd36e1ba91c71eb28193128fddf5ce9cd141 (branch unchecked-three-args-open):

  • [ ] awk
  • [ ] deroff
  • [ ] man
  • [ ] patch

briandfoy avatar Jan 10 '21 12:01 briandfoy