[Catalyst] Test that slurp() on Upload objects can be run twice.

Adam Sjøgren adsj at novozymes.com
Tue Feb 15 15:35:19 GMT 2011


---
I noticed that calling slurp on a Catalyst::Request::Upload object twice
returns an empty string the second time.

I tried to modify t/aggregate/live_engine_request_uploads.t to add a
failing test, but if I call slurp() there, I get an error about the
temporary file missing.

So this crude change below, just calling slurp() twice, makes existing
tests fail, instead.

 t/lib/TestApp/Controller/Engine/Request/Uploads.pm |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/t/lib/TestApp/Controller/Engine/Request/Uploads.pm b/t/lib/TestApp/Controller/Engine/Request/Uploads.pm
index f51df9d..7ebcd65 100644
--- a/t/lib/TestApp/Controller/Engine/Request/Uploads.pm
+++ b/t/lib/TestApp/Controller/Engine/Request/Uploads.pm
@@ -6,6 +6,7 @@ use base 'Catalyst::Controller';
 sub slurp : Relative {
     my ( $self, $c ) = @_;
     $c->response->content_type('text/plain; charset=utf-8');
+    $c->request->upload('slurp')->slurp;
     $c->response->output( $c->request->upload('slurp')->slurp );
 }
 
-- 
1.7.2.3



More information about the Catalyst mailing list