Re: Weird file permission problem with File::Temp

[prev] [thread] [next] [Date index for 2004/11/23]

From: RobertCZ
Subject: Re: Weird file permission problem with File::Temp
Date: 12:16 on 23 Nov 2004
--------------010300030707040308020408
Content-Type: text/plain; charset=ISO-8859-2; format=flowed
Content-Transfer-Encoding: 7bit

Stas Bekman wrote:

> RobertCZ wrote:
>
>> I'm trying to create temp file in PerlFixupHandler using File::Temp, 
>> write to it, send it to the client and get the temp file 
>> automatically unlinked upon the end of the request.
>> I keep getting file permission error.
>
> 2) you said:
> $fh = new File::Temp( DIR => '/tmp/aimcache', UNLINK => 1 );
> so by the time the response phase comes, the file is not there anymore.
>
> instead you could use the approach explained here:
> http://perl.apache.org/docs/2.0/user/handlers/http.html#PerlCleanupHandler 
>
> or simply use the response phase and sendfile() to send the contents.


This *|cleanup_register()|* trick works great, thank you very much, I 
have spent way too much time on this thing...

I'm not sure why Gerald Richter uses PerlFixupHandler but I guess he has 
his reason, so I don't want to fool with it. (it's Apache::ImageMagick 
module I'm trying to port)

I have however one more question (I've posted this in other email, but 
it's related): In this FixupHandler when I create a new file and use it 
with $r -> filename ($tmpnam) ,  Apache still thinks size is that of the 
originally requested file. Is there a way to change it? Thanks again.

- Robert



--------------010300030707040308020408
Content-Type: text/html; charset=ISO-8859-2
Content-Transfer-Encoding: 8bit

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
  <meta content="text/html;charset=ISO-8859-2" http-equiv="Content-Type">
  <title></title>
</head>
<body bgcolor="#ffffff" text="#000000">
Stas Bekman wrote:
<blockquote cite="mid41A2C5D0.1060705@xxxxxx.xxx" type="cite">RobertCZ
wrote:
  <br>
  <blockquote type="cite">I'm trying to create temp file in
PerlFixupHandler using File::Temp, write to it, send it to the client
and get the temp file automatically unlinked upon the end of the
request.
    <br>
I keep getting file permission error.
    <br>
  </blockquote>
2) you said:
  <br>
$fh = new File::Temp( DIR =&gt; '/tmp/aimcache', UNLINK =&gt; 1 );
  <br>
so by the time the response phase comes, the file is not there anymore.
  <br>
  <br>
instead you could use the approach explained here:
  <br>
<a class="moz-txt-link-freetext" href="http://perl.apache.org/docs/2.0/user/handlers/http.html#PerlCleanupHandler">http://perl.apache.org/docs/2.0/user/handlers/http.html#PerlCleanupHandler</a>;
  <br>
or simply use the response phase and sendfile() to send the contents.
  <br>
</blockquote>
<br>
This <b><code>cleanup_register()</code></b> trick works great, thank
you very much, I have spent way too much time on this thing...<br>
<br>
I'm not sure why Gerald Richter uses PerlFixupHandler but I guess he
has his reason, so I don't want to fool with it. (it's
Apache::ImageMagick module I'm trying to port)<br>
<br>
I have however one more question (I've posted this in other email, but
it's related): In this FixupHandler when I create a new file and use it
with $r -&gt; filename ($tmpnam) ,  Apache still thinks size is that of
the originally requested file. Is there a way to change it? Thanks
again.<br>
<br>
- Robert<br>
<br>
<br>
</body>
</html>

--------------010300030707040308020408--

Re: Weird file permission problem with File::Temp
RobertCZ 12:16 on 23 Nov 2004

Generated at 11:26 on 21 Dec 2004 by mariachi v0.52