in reply to Re^10: Need sleep walking help
in thread Need sleep walking help

Hi Marshall,

I just wanted to point out the -t operator that tests whether a filehandle is connected to a TTY. I don't know if this is the same mechanism that Perl uses to decide whether to use line-buffered mode or not, and I dimly remember reading somewhere that the -t test isn't always reliable, but anyway, this snippet would probably also confirm the issue.

$ perl -e 'warn "STDOUT ".(-t STDOUT?"IS":"is NOT")." a TTY\n"' STDOUT IS a TTY $ perl -e 'warn "STDOUT ".(-t STDOUT?"IS":"is NOT")." a TTY\n"' | cat STDOUT is NOT a TTY

Regards,
-- Hauke D

Replies are listed 'Best First'.
Re^12: Need sleep walking help
by choroba (Cardinal) on Feb 04, 2017 at 16:55 UTC
    > I dimly remember reading somewhere that the -t test isn't always reliable

    Probably in Perl::Critic::Policy::InputOutput::ProhibitInteractiveTest ? It doesn't say why, but it offers an alternative.

    ($q=q:Sq=~/;[c](.)(.)/;chr(-||-|5+lengthSq)`"S|oS2"`map{chr |+ord }map{substrSq`S_+|`|}3E|-|`7**2-3:)=~y+S|`+$1,++print+eval$q,q,a,