X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=catagits%2FHTTP-Body.git;a=blobdiff_plain;f=lib%2FHTTP%2FBody%2FMultiPart.pm;fp=lib%2FHTTP%2FBody%2FMultiPart.pm;h=18354abc1004fb47de1e03f64d1a914972521608;hp=c9273d4edf75960d4fcd21f4b586123cb6a9f263;hb=cc75c886256f187cda388641931e8dafad6c2346;hpb=b554d2f5fac821338a7508f412f658015cd1e0bd diff --git a/lib/HTTP/Body/MultiPart.pm b/lib/HTTP/Body/MultiPart.pm index c9273d4..18354ab 100644 --- a/lib/HTTP/Body/MultiPart.pm +++ b/lib/HTTP/Body/MultiPart.pm @@ -256,7 +256,9 @@ sub parse_body { =cut our $basename_regexp = qr/[^.]+(\.[^\\\/]+)$/; -#our $basename_regexp = qr/(\.\w+(?:\.\w+)*)$/; +our $file_temp_suffix = '.upload'; +our $file_temp_template; +our %file_temp_parameters; sub handler { my ( $self, $part ) = @_; @@ -277,7 +279,11 @@ sub handler { my $basename = (File::Spec->splitpath($filename))[2]; my $suffix = $basename =~ $basename_regexp ? $1 : q{}; - my $fh = File::Temp->new( UNLINK => 0, DIR => $self->tmpdir, SUFFIX => $suffix ); + my $fh = File::Temp->new( + UNLINK => 0, DIR => $self->tmpdir, SUFFIX => ($file_temp_suffix||$suffix), + ( $file_temp_template ? ( TEMPLATE => $file_temp_template ) : () ), + %file_temp_parameters, + ); $part->{fh} = $fh; $part->{tempname} = $fh->filename; @@ -311,6 +317,10 @@ sub handler { =back +=head1 SUPPORT + +See L + =head1 AUTHOR Christian Hansen, C