r22617 - in /branches/upstream/libhttp-body-perl/current: Changes META.yml README lib/HTTP/Body.pm lib/HTTP/Body/MultiPart.pm lib/HTTP/Body/OctetStream.pm t/04multipart.t

eloy at users.alioth.debian.org eloy at users.alioth.debian.org
Tue Jul 1 10:06:54 UTC 2008


Author: eloy
Date: Tue Jul  1 10:06:53 2008
New Revision: 22617

URL: http://svn.debian.org/wsvn/pkg-perl/?sc=1&rev=22617
Log:
[svn-upgrade] Integrating new upstream version, libhttp-body-perl (1.04)

Modified:
    branches/upstream/libhttp-body-perl/current/Changes
    branches/upstream/libhttp-body-perl/current/META.yml
    branches/upstream/libhttp-body-perl/current/README
    branches/upstream/libhttp-body-perl/current/lib/HTTP/Body.pm
    branches/upstream/libhttp-body-perl/current/lib/HTTP/Body/MultiPart.pm
    branches/upstream/libhttp-body-perl/current/lib/HTTP/Body/OctetStream.pm
    branches/upstream/libhttp-body-perl/current/t/04multipart.t

Modified: branches/upstream/libhttp-body-perl/current/Changes
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libhttp-body-perl/current/Changes?rev=22617&op=diff
==============================================================================
--- branches/upstream/libhttp-body-perl/current/Changes (original)
+++ branches/upstream/libhttp-body-perl/current/Changes Tue Jul  1 10:06:53 2008
@@ -1,4 +1,8 @@
 This file documents the revision history for Perl extension HTTP::Body.
+
+1.04    2008-06-23 16:00:00
+        - Added tmpdir() accessor to specify an alternate directory for temp files.
+          (jgoulah)
 
 1.03    2008-04-07 08:20:00
         - Set body value for XForms data. (Daniel Ruoso)

Modified: branches/upstream/libhttp-body-perl/current/META.yml
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libhttp-body-perl/current/META.yml?rev=22617&op=diff
==============================================================================
--- branches/upstream/libhttp-body-perl/current/META.yml (original)
+++ branches/upstream/libhttp-body-perl/current/META.yml Tue Jul  1 10:06:53 2008
@@ -1,7 +1,7 @@
 # http://module-build.sourceforge.net/META-spec.html
 #XXXXXXX This is a prototype!!!  It will change in the future!!! XXXXX#
 name:         HTTP-Body
-version:      1.03
+version:      1.04
 version_from: lib/HTTP/Body.pm
 installdirs:  site
 requires:

Modified: branches/upstream/libhttp-body-perl/current/README
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libhttp-body-perl/current/README?rev=22617&op=diff
==============================================================================
--- branches/upstream/libhttp-body-perl/current/README (original)
+++ branches/upstream/libhttp-body-perl/current/README Tue Jul  1 10:06:53 2008
@@ -84,6 +84,10 @@
     upload
         Get/set file uploads.
 
+    tmpdir
+        Specify a different path for temporary files. Defaults to the system
+        temporary path.
+
 AUTHOR
     Christian Hansen, "ch at ngmedia.com"
 

Modified: branches/upstream/libhttp-body-perl/current/lib/HTTP/Body.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libhttp-body-perl/current/lib/HTTP/Body.pm?rev=22617&op=diff
==============================================================================
--- branches/upstream/libhttp-body-perl/current/lib/HTTP/Body.pm (original)
+++ branches/upstream/libhttp-body-perl/current/lib/HTTP/Body.pm Tue Jul  1 10:06:53 2008
@@ -4,7 +4,7 @@
 
 use Carp       qw[ ];
 
-our $VERSION = '1.03';
+our $VERSION = '1.04';
 
 our $TYPES = {
     'application/octet-stream'          => 'HTTP::Body::OctetStream',
@@ -113,7 +113,8 @@
         length         => 0,
         param          => {},
         state          => 'buffering',
-        upload         => {}
+        upload         => {},
+        tmpdir         => File::Spec->tmpdir(),
     };
 
     bless( $self, $body );
@@ -355,6 +356,18 @@
     return $self->{upload};
 }
 
+=item tmpdir 
+
+Specify a different path for temporary files.  Defaults to the system temporary path.
+
+=cut
+
+sub tmpdir {
+    my $self = shift;
+    $self->{tmpdir} = shift if @_;
+    return $self->{tmpdir};
+}
+
 =back
 
 =head1 AUTHOR

Modified: branches/upstream/libhttp-body-perl/current/lib/HTTP/Body/MultiPart.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libhttp-body-perl/current/lib/HTTP/Body/MultiPart.pm?rev=22617&op=diff
==============================================================================
--- branches/upstream/libhttp-body-perl/current/lib/HTTP/Body/MultiPart.pm (original)
+++ branches/upstream/libhttp-body-perl/current/lib/HTTP/Body/MultiPart.pm Tue Jul  1 10:06:53 2008
@@ -270,7 +270,7 @@
             $part->{filename} = $filename;
 
             if ( $filename ne "" ) {
-                my $fh = File::Temp->new( UNLINK => 0 );
+                my $fh = File::Temp->new( UNLINK => 0, DIR => $self->tmpdir );
 
                 $part->{fh}       = $fh;
                 $part->{tempname} = $fh->filename;

Modified: branches/upstream/libhttp-body-perl/current/lib/HTTP/Body/OctetStream.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libhttp-body-perl/current/lib/HTTP/Body/OctetStream.pm?rev=22617&op=diff
==============================================================================
--- branches/upstream/libhttp-body-perl/current/lib/HTTP/Body/OctetStream.pm (original)
+++ branches/upstream/libhttp-body-perl/current/lib/HTTP/Body/OctetStream.pm Tue Jul  1 10:06:53 2008
@@ -30,7 +30,7 @@
     my $self = shift;
 
     unless ( $self->body ) {
-        $self->body( File::Temp->new );
+        $self->body( File::Temp->new( DIR => $self->tmpdir ) );
     }
 
     if ( my $length = length( $self->{buffer} ) ) {

Modified: branches/upstream/libhttp-body-perl/current/t/04multipart.t
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libhttp-body-perl/current/t/04multipart.t?rev=22617&op=diff
==============================================================================
--- branches/upstream/libhttp-body-perl/current/t/04multipart.t (original)
+++ branches/upstream/libhttp-body-perl/current/t/04multipart.t Tue Jul  1 10:06:53 2008
@@ -3,13 +3,14 @@
 use strict;
 use warnings;
 
-use Test::More tests => 60;
+use Test::More tests => 98;
 
 use Cwd;
 use HTTP::Body;
 use File::Spec::Functions;
 use IO::File;
 use YAML;
+use File::Temp qw/ tempdir /;
 
 my $path = catdir( getcwd(), 't', 'data', 'multipart' );
 
@@ -20,6 +21,10 @@
     my $results = YAML::LoadFile( catfile( $path, "$test-results.yml" ) );
     my $content = IO::File->new( catfile( $path, "$test-content.dat" ) );
     my $body    = HTTP::Body->new( $headers->{'Content-Type'}, $headers->{'Content-Length'} );
+    my $tempdir = tempdir( 'XXXXXXX', CLEANUP => 1, DIR => File::Spec->tmpdir() );
+    $body->tmpdir($tempdir);
+
+    my $regex_tempdir = quotemeta($tempdir);
 
     binmode $content, ':raw';
 
@@ -35,6 +40,7 @@
         my $value = $body->upload->{$field};
 
         for ( ( ref($value) eq 'ARRAY' ) ? @{$value} : $value ) {
+            like($_->{tempname}, qr{$regex_tempdir}, "has tmpdir $tempdir");
             push @temps, delete $_->{tempname};
         }
     }




More information about the Pkg-perl-cvs-commits mailing list