Subject: | Upload abort detection doesn't work |
Hi,
I'm currently playing around with your Catalyst::Plugin::UploadProgress
and it fits quite good into our application.
While I was ebuilding the frontend part on my own (to match our look and
feel) I realized, that the abort detection doesn't work. I played around
with the code and see only one minor problem: The exception is thrown
correctly by Catalyst, but the current code construct doesn't recognize
it. Changing it to a standard eval and if($@) construct works fine for
me, so far.
Maybe you want to include the attached patch to your next release?
Here are my system specs:
Perl 5.10.1
Mac OS X 10.6
Catalyst 5.80022
Regards
Phil
Subject: | UploadProgress.patch |
--- UploadProgress-orig.pm 2011-01-24 15:16:31.000000000 +0100
+++ UploadProgress-patched.pm 2011-01-24 15:17:17.000000000 +0100
@@ -49,18 +49,12 @@
# Detect if the user stopped the upload, prepare_body will die with an invalid
# content-length error
- my $croaked;
-
- {
- no warnings 'redefine';
- local *Carp::croak = sub {
- $croaked = shift;
- };
+ eval {
$c->$orig(@_);
- }
+ };
- if ( $croaked ) {
+ if ( $@ ) {
if ( my $id = $c->req->query_parameters->{progress_id} ) {
$c->log->info( "UploadProgress: User aborted upload $id" );
@@ -73,7 +67,7 @@
}
# rethrow the error
- Catalyst::Exception->throw( $croaked );
+ die ($@);
}
};