You might try using the -t file test operator, this should be able to tell you whether a handle is opened to TTY (and hence not flock()able) and not to a file:
print "Yow!" if -t STDOUT; open SAVOUT, '>&STDOUT'; close STDOUT; open STDOUT, '>stdout.txt'; print "Yow!" if -t STDOUT;
/J\
In reply to Re: Avoiding accidentally flock()'ing STDOUT
by gellyfish
in thread Avoiding accidentally flock()'ing STDOUT
by shay
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |