You are viewing a plain text version of this content. The canonical link for it is here.
Posted to modperl@perl.apache.org by Jonathan Vanasco <mo...@2xlp.com> on 2006/08/22 08:33:49 UTC

Apache::File

Does anyone plan on porting Apache::File to Apache2 ?

I'm using it in the Apache2::compat mode right now, but I feel uneasy  
using compat outside of my dev box

I took a stab at porting the perl part of File and Symdump, but File  
has an xs component I know i can't handle myself.


Re: Apache::File

Posted by Perrin Harkins <pe...@elem.com>.
On Tue, 2006-08-22 at 11:30 -0400, Jonathan Vanasco wrote:
> Maybe i can wrap / subclass APR::File and then just add the tmpfile  
> functionality

If you use File::Temp, they will disappear when you close the file on
most OSes.  Or you can do this:

$r->push_handlers(PerlCleanupHandler => sub { File::Temp::cleanup() });

- Perrin


Re: Apache::File

Posted by Jonathan Vanasco <jo...@2xlp.com>.
On Aug 22, 2006, at 9:52 AM, Geoffrey Young wrote:

> Tom Schindl wrote:
>> What does Apache::File provide other classes in mp2/standard perl  
>> don't?
>> - $fh->tmpfile()             => File::Temp
>
> this is the only one that comes to mind - Apache::File::tmpfile()
> creates a temporary file that lingers for the rest of the request  
> and is
> cleaned up automatically via a per-request cleanup.  existing tempfile
> tools aren't _exactly_ like this.  sure, it's simple enough to code	
> yourself, but we used to offer this as part of the bundle...

Hmm...

Maybe i can wrap / subclass APR::File and then just add the tmpfile  
functionality

Re: Apache::File

Posted by Geoffrey Young <ge...@modperlcookbook.org>.
Tom Schindl wrote:
> Jonathan Vanasco schrieb:
> 
>>Does anyone plan on porting Apache::File to Apache2 ?
>>
>>I'm using it in the Apache2::compat mode right now, but I feel uneasy
>>using compat outside of my dev box
>>
>>I took a stab at porting the perl part of File and Symdump, but File has
>>an xs component I know i can't handle myself.
>>
>>
> 
> 
> What does Apache::File provide other classes in mp2/standard perl don't?
> 

> - $fh->tmpfile()             => File::Temp

this is the only one that comes to mind - Apache::File::tmpfile()
creates a temporary file that lingers for the rest of the request and is
cleaned up automatically via a per-request cleanup.  existing tempfile
tools aren't _exactly_ like this.  sure, it's simple enough to code
yourself, but we used to offer this as part of the bundle...

--Geoff

Re: Apache::File

Posted by Tom Schindl <li...@bestsolution.at>.
Jonathan Vanasco schrieb:
> Does anyone plan on porting Apache::File to Apache2 ?
> 
> I'm using it in the Apache2::compat mode right now, but I feel uneasy
> using compat outside of my dev box
> 
> I took a stab at porting the perl part of File and Symdump, but File has
> an xs component I know i can't handle myself.
> 
> 

What does Apache::File provide other classes in mp2/standard perl don't?

- $fh->open()                => APR::PerlIO/Standard Perl
- $fh->close()               => APR::PerlIO/Standard Perl
- $fh->tmpfile()             => File::Temp
- $r->discard_request_body() => Apache2::RequestIO
- $r->meets_conditions()     => Apache2::Response
- $r->mtime()                => Apache2::RequestRec
- $r->set_content_length()   => Apache2::Response
- $r->set_etag()             => Apache2::Response
- $r->set_last_modified()    => Apache2::Response
- $r->update_mtime()         => Apache2::Response

Tom