[Catalyst-commits] r7451 - in trunk/HTTP-Body: . lib/HTTP t
andyg at dev.catalyst.perl.org
andyg at dev.catalyst.perl.org
Sat Feb 23 15:19:50 GMT 2008
Author: andyg
Date: 2008-02-23 15:19:50 +0000 (Sat, 23 Feb 2008)
New Revision: 7451
Modified:
trunk/HTTP-Body/Changes
trunk/HTTP-Body/lib/HTTP/Body.pm
trunk/HTTP-Body/t/04multipart.t
Log:
HTTP::Body, fixed multipart test to properly clean up temp files
Modified: trunk/HTTP-Body/Changes
===================================================================
--- trunk/HTTP-Body/Changes 2008-02-23 15:07:19 UTC (rev 7450)
+++ trunk/HTTP-Body/Changes 2008-02-23 15:19:50 UTC (rev 7451)
@@ -4,6 +4,7 @@
- Added support for chunked requests if no $length value is passed to new().
- Fixed urlencoded parser to handle spaces after semicolons and equal signs
in the value. (Tom Heady, http://rt.cpan.org/Ticket/Display.html?id=31055)
+ - Fixed multipart test to properly clean up temporary files.
0.9 2007-03-27 14:00:00
- Fixed bug where empty fields in multipart/form-data were ignored.
Modified: trunk/HTTP-Body/lib/HTTP/Body.pm
===================================================================
--- trunk/HTTP-Body/lib/HTTP/Body.pm 2008-02-23 15:07:19 UTC (rev 7450)
+++ trunk/HTTP-Body/lib/HTTP/Body.pm 2008-02-23 15:19:50 UTC (rev 7451)
@@ -60,6 +60,12 @@
It is currently used by L<Catalyst> to parse POST bodies.
+=head1 NOTES
+
+When parsing multipart bodies, temporary files are created to store any
+uploaded files. You must delete these temporary files yourself after
+processing them.
+
=head1 METHODS
=over 4
Modified: trunk/HTTP-Body/t/04multipart.t
===================================================================
--- trunk/HTTP-Body/t/04multipart.t 2008-02-23 15:07:19 UTC (rev 7450)
+++ trunk/HTTP-Body/t/04multipart.t 2008-02-23 15:19:50 UTC (rev 7451)
@@ -27,12 +27,15 @@
$body->add($buffer);
}
+ # Save tempnames for later deletion
+ my @temps;
+
for my $field ( keys %{ $body->upload } ) {
my $value = $body->upload->{$field};
for ( ( ref($value) eq 'ARRAY' ) ? @{$value} : $value ) {
- delete $_->{tempname};
+ push @temps, delete $_->{tempname};
}
}
@@ -41,4 +44,7 @@
is_deeply( $body->upload, $results->{upload}, "$test MultiPart upload" );
cmp_ok( $body->state, 'eq', 'done', "$test MultiPart state" );
cmp_ok( $body->length, '==', $body->content_length, "$test MultiPart length" );
+
+ # Clean up temp files created
+ unlink map { $_ } grep { -e $_ } @temps;
}
More information about the Catalyst-commits
mailing list