CassJ has asked for the wisdom of the Perl Monks concerning the following question:
If I have a filehandle, how can I get at the filename? What I really want it to do is give me the name when I treat is as a string, like a CGI upload filehandle. I don't seem to be able to find anything about this from google, but I'm not really sure what I should be looking for. Can someone point me in the right direction?
Thanks, Cxx
just found this via google: > Is there a way to get the filename from an open filehandle >that has been passed to another package? No. There may not even *be* a filename.
So can I amend my question: I'm trying to test some code that would normally take an uploaded (CGI) filehandle and use it's file extension to guess if it's an archive and unpack it appropriately. I want to be able to test it directly, so how do I create an object that mimics the behaviour of cgi filehandles?
Thanks again.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: filenames from filehandles
by chromatic (Archbishop) on Jun 23, 2004 at 19:18 UTC | |
by CassJ (Sexton) on Jun 24, 2004 at 11:28 UTC | |
|
Re: filenames from filehandles
by theorbtwo (Prior) on Jun 23, 2004 at 19:44 UTC | |
by ikegami (Patriarch) on Feb 06, 2009 at 17:29 UTC | |
|
Re: filenames from filehandles
by CassJ (Sexton) on Jun 23, 2004 at 16:09 UTC |