How do I determine whether a filehandle is open?

How do I determine whether a filehandle is open?

am 11.04.2008 21:10:15 von Frank Seitz

I didn't find it in the FAQ.
How do I determine whether a filehandle
(STDERR in my case) is open?

Frank
--
Dipl.-Inform. Frank Seitz; http://www.fseitz.de/
Anwendungen für Ihr Internet und Intranet
Tel: 04103/180301; Fax: -02; Industriestr. 31, 22880 Wedel

Re: How do I determine whether a filehandle is open?

am 11.04.2008 21:23:04 von it_says_BALLS_on_your forehead

On Apr 11, 3:10=A0pm, Frank Seitz wrote:
> I didn't find it in the FAQ.
> How do I determine whether a filehandle
> (STDERR in my case) is open?

if ( defined fileno STDERR ) {
print STDERR "SOME DATA";
}
else {
warn "Error: STDERR is closed!\n";
}

Re: How do I determine whether a filehandle is open?

am 11.04.2008 21:23:37 von Joost Diepenmaat

Frank Seitz writes:

> I didn't find it in the FAQ.
> How do I determine whether a filehandle
> (STDERR in my case) is open?

see perldoc -f fileno

--
Joost Diepenmaat | blog: http://joost.zeekat.nl/ | work: http://zeekat.nl/

Re: How do I determine whether a filehandle is open?

am 11.04.2008 21:32:59 von Frank Seitz

nolo contendere wrote:
> On Apr 11, 3:10 pm, Frank Seitz wrote:
>
>>I didn't find it in the FAQ.
>>How do I determine whether a filehandle
>>(STDERR in my case) is open?
>
> if ( defined fileno STDERR ) {
> print STDERR "SOME DATA";
> }
> else {
> warn "Error: STDERR is closed!\n";
> }

Simon, Joost: Thank you!

Frank
--
Dipl.-Inform. Frank Seitz; http://www.fseitz.de/
Anwendungen für Ihr Internet und Intranet
Tel: 04103/180301; Fax: -02; Industriestr. 31, 22880 Wedel