Re: Treating filehandles like strings
[email protected] (Jonathan Scott Duff) Tue, 8 Aug 2000 12:48:04 -0500
| Newsgroups | perl.perl6.language.io |
|---|---|
| Message-ID | <[email protected]> |
On Tue, Aug 08, 2000 at 12:09:52PM +0200, Bart Lateur wrote: > On Mon, 07 Aug 2000 17:43:29 -0700, Nathan Wiger wrote: > > >> I'd rather have a filehandle stringify to > >> the filename instead. > > > >Great minds think alike. :-) I was actually going to add this to the new > >version of the open() RFC as a possible use of RFC 49's > >soon-to-be-renamed STRING method. > > > >Now I know I have at least I have one supporter! ;-) > > This question has been asked a few times on comp.lang.perl.misc. It is > in general not possible. On Unix, a file can have more than one name. > The name can be changed while the file is open. Do you want the > filehandle to track that? Another file could have taken the name, after > the first file was opened. It's even possible that the name is deleted, > so there IS no more name for it. It should return the filename under which the file was opened. This should be relatively easy to stash away somewhere for future reference. -Scott -- Jonathan Scott Duff [email protected]