Perl::Critic::Policy::InputOutput::ProhibitOneArgSelect(3pm)

Perl::Critic::Policy::InputOutput::ProhibitOneArgSelect3pm

Never write "select($fh)".

Affiliation

This Policy is part of the core Perl::Critic distribution.

Overview

Conway discourages the use of a raw select() when setting autoflushes. We'll extend that further by simply prohibiting the one-argument form of select() entirely; if you really need it you should know when/where/why that is. For performing autoflushes, Conway recommends the use of "IO::Handle" instead.

  select((select($fh), $|=1)[0]);     # not ok
  select $fh;                         # not ok
   use IO::Handle;
   $fh->autoflush();                   # ok
   *STDOUT->autoflush();               # ok

Configuration

This Policy is not configurable except for the standard options.

Releases

10 releases since Debian 5.0 (Lenny); the text changed 9 times.

  1. 5.0
  2. 6.0
  3. 7
  4. 8
  5. 9
  6. 10
  7. 11
  8. 12
  9. 13
  10. Arch

Author

Graham TerMarsch <[email protected]>

From perl-perl-critic 1.156-3 in Arch Linux 2026-11-01. Parsed by carta from the page's man source.