From: Ronald Fischer Date: 2007-07-16T17:35:03+09:00 Subject: Re: Tempfile : delete problem (SOLVED) > 2007/7/12, Ronald Fischer : > > > > file=Tempfile.new('.tempreq','/thome/requests') > > > > file << '....' # populate the file > > > > path=file.path # remember the generated filename > > > > file.close > > > > result=path+'.xml' # add desired extension to the filename > > > > File.rename(path,result) # rename file > > > > at_exit { File::delete(result) } # remove file at exit > > > > > > > > When the exit handler jumps into action, I get however > the following > > > > error: > > > > > > > > H:\thome\grubylib/TfwCommon.rb:433:in `delete': > Permission denied - > > > > /thome/requests/.tempr > > > > eq.3176.0.xml (Errno::EACCES) > In that case rather use your own mechanism. That's too far away from > tempfile's functionality. I found a solution based on an idea posted at http://marsorange.com/articles/2006/07/17/of-mogrify-ruby-tempfile-dynam ic-class-definitions which allowed me to use most of Tempfile functionality with only providing minimal own code: require 'tempfile' class XMLTempfile