close("all open files") - possible?

J

jon rogers

Hi

I have a problem with my Perl script not deleting all - but only some -
temporary files it is supposed to delete. The r/w file status is 777.

The only thing I can think of is that I have unclosed file handles laying
around in the code. Is there some easy way of closing all open file handles
in one go, or will I have to track them down one by one?

Thanks,

J
 
J

James Willmore

I have a problem with my Perl script not deleting all - but only
some - temporary files it is supposed to delete. The r/w file status
is 777.

And your error is ($!) when trying to delete them?
The only thing I can think of is that I have unclosed file handles
laying around in the code. Is there some easy way of closing all
open file handles in one go, or will I have to track them down one
by one?

If you use IO::File to open/read/write/close the files, when you
'undef' the file handle, the file will close.

Having said that, what do you mean by "temporary"? Are these files
you open or are opened using IO::File?

--
Jim

Copyright notice: all code written by the author in this post is
released under the GPL. http://www.gnu.org/licenses/gpl.txt
for more information.

a fortune quote ...
It wasn't that she had a rose in her teeth, exactly. It was more
like the rose and the teeth were in the same glass.
 
G

Greg Bacon

: I have a problem with my Perl script not deleting all - but only
: some - temporary files it is supposed to delete. The r/w file
: status is 777.
:
: The only thing I can think of is that I have unclosed file handles
: laying around in the code. Is there some easy way of closing all open
: file handles in one go, or will I have to track them down one by one?

Can you provide a *small* example that demonstrates the problem?

Greg
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
474,257
Messages
2,571,031
Members
48,768
Latest member
first4landlord

Latest Threads

Top