Click here to get back home

How do I determine whether a filehandle is open?

 HomeNewsGroups | Search | About
 comp.lang.perl.misc    Post an article   get this group's latest topics as an RSS feed add this group's latest topics to your My MSN content add this group's latest topics to your My Yahoo content
Subject Author Date
How do I determine whether a filehandle is open? Frank Seitz 04-11-2008
Posted by Frank Seitz on April 11, 2008, 3:10 pm
Please log in for more thread options
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

Posted by nolo contendere on April 11, 2008, 3:23 pm
Please log in for more thread options
> 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";
}


Posted by Frank Seitz on April 11, 2008, 3:32 pm
Please log in for more thread options
nolo contendere 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

Posted by Joost Diepenmaat on April 11, 2008, 3:23 pm
Please log in for more thread options

> 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/

Similar ThreadsPosted
FAQ 5.12 How can I open a filehandle to a string? March 9, 2008, 9:03 am
FAQ 5.12 How can I open a filehandle to a string? May 26, 2008, 3:03 pm
FAQ 5.12 How can I open a filehandle to a string? August 4, 2008, 9:03 pm
can you determine username? February 15, 2006, 5:41 am
How would I determine a callers object ref ? November 24, 2005, 7:38 am
How does one determine the language used on a windows OS? December 6, 2005, 9:38 am
How to determine memory usage? January 21, 2006, 7:03 pm
How to determine whether output is a terminal? November 21, 2007, 11:28 pm
Determine weekends and compare two days September 27, 2004, 1:42 am
Determine length of input as it is typed March 18, 2006, 3:52 pm

Our other projects:

Art Dolls, Fairies and Mermaids - Sunnyfaces.net

Roy's Linux, Programming and Search Engines messages

1-Script XML SitemapXML Sitemap