7 use lib "$FindBin::Bin/lib";
9 use Test::More tests => 3;
14 use File::Spec::Functions;
17 use File::Temp qw/ tempdir /;
19 my $path = catdir( getcwd(), 't', 'data', 'multipart' );
22 $HTTP::Body::MultiPart::file_temp_suffix = undef;
23 $HTTP::Body::MultiPart::basename_regexp = qr/(\.\w+(?:\.\w+)*)$/;
25 my $uploads = uploads_for('015');
28 my ($volume,$directories,$file) = File::Spec->splitpath( $uploads->{upload}{tempname} );
30 $file, qr/^.{10}\.tar\.gz\.Z$/,
31 'tempname preserves .tar.gz.Z suffix'
36 my ($volume,$directories,$file) = File::Spec->splitpath( $uploads->{upload2}{tempname} );
38 $file, qr/^.{10}\.png$/,
39 'tempname preserves .png suffix'
44 my ($volume,$directories,$file) = File::Spec->splitpath( $uploads->{upload3}{tempname} );
46 $file, qr/^.{10}\.txt$/,
47 'tempname preserves .txt suffix'
56 my $headers = PAML::LoadFile( catfile( $path, "$number-headers.pml" ) );
57 my $content = IO::File->new( catfile( $path, "$number-content.dat" ) );
58 my $body = HTTP::Body->new( $headers->{'Content-Type'}, $headers->{'Content-Length'} );
59 my $tempdir = tempdir( 'XXXXXXX', CLEANUP => 1, DIR => File::Spec->tmpdir() );
60 $body->tmpdir($tempdir);
62 binmode $content, ':raw';
64 while ( $content->read( my $buffer, 1024 ) ) {