Re: [Catalyst] Catalyst::Request::Upload - uploadtmp

2007-06-08 Thread Andy Grundman


On Jun 8, 2007, at 10:09 AM, Tobias Kremer wrote:


The manpage of Catalyst::Request::Upload suggests the following:

--snip--

To specify where Catalyst should put the temporary files, set the  
'uploadtmp'
option in the Catalyst config. If unset, Catalyst will use the  
system temp dir.


__PACKAGE__-config( uploadtmp = '/path/to/tmpdir' );

--snip--

Unfortunately this doesn't work for me (all file uploads are placed  
in the

system default location, e.g. /tmp).

Now, there's this in Catalyst::Engine:

#321: $c-request-{_body}-{tmpdir} = $c-config-{uploadtmp}

But HTTP::Body::MultiPart doesn't consider $self-{tmpdir} in its  
call to
File::Temp. Looks like tmpdir isn't used at all and really should  
be added

as an object method to avoid poking in the HTTP::Body object.

Have I misunderstood the purpose of uploadtmp? If not, I'd be happy to
provide patches for HTTP::Body::MultiPart and Catalyst::Engine.


This sounds like a bug in HTTP::Body, a patch would be great, thanks!

-Andy

___
List: Catalyst@lists.rawmode.org
Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@lists.rawmode.org/
Dev site: http://dev.catalyst.perl.org/


Re: [Catalyst] Catalyst::Request::Upload - uploadtmp

2007-06-08 Thread Tobias Kremer
 On Jun 8, 2007, at 10:09 AM, Tobias Kremer wrote:
  The manpage of Catalyst::Request::Upload suggests the following:
  --snip--
  To specify where Catalyst should put the temporary files, set the
  'uploadtmp'
  option in the Catalyst config. If unset, Catalyst will use the
  system temp dir.
  __PACKAGE__-config( uploadtmp = '/path/to/tmpdir' );
  --snip--
  Unfortunately this doesn't work for me (all file uploads are placed
  in the
  system default location, e.g. /tmp).
  Now, there's this in Catalyst::Engine:
  #321: $c-request-{_body}-{tmpdir} = $c-config-{uploadtmp}
  But HTTP::Body::MultiPart doesn't consider $self-{tmpdir} in its
  call to
  File::Temp. Looks like tmpdir isn't used at all and really should
  be added
  as an object method to avoid poking in the HTTP::Body object.
  Have I misunderstood the purpose of uploadtmp? If not, I'd be happy to
  provide patches for HTTP::Body::MultiPart and Catalyst::Engine.

 This sounds like a bug in HTTP::Body, a patch would be great, thanks!

 -Andy

Patch attached. Hope it's okay.

--Tobias
--- MultiPart.pm.orig	2007-06-08 17:16:12.0 +0200
+++ MultiPart.pm	2007-06-08 17:18:42.0 +0200
@@ -273,7 +273,7 @@
 
 if ($filename) {
 
-my $fh = File::Temp-new( UNLINK = 0 );
+my $fh = File::Temp-new( UNLINK = 0, DIR = $self-{tmpdir} );
 
 $part-{fh}   = $fh;
 $part-{tempname} = $fh-filename;
___
List: Catalyst@lists.rawmode.org
Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@lists.rawmode.org/
Dev site: http://dev.catalyst.perl.org/