Subject: | $app->run() error handler breaks exception objects. |
In the following block, the regex on line 702 destroys Exception::Class
objects (AFAIK), to avoid doing this, the regex should check if $@ is a
reference.
CGI::Application::Dispatch
|| 694 eval {
|| 695 my $app = ref($args) eq 'HASH' ? $module->new($args) :
$module->new();
|| 696 $app->mode_param(sub { return $rm }) if($rm);
|| 697 $output = $app->run();
|| 698 };
|| 699
|| 700 if($@) {
|| 701 # catch invalid run-mode stuff
|| 702 if($@ =~ /No such run mode/) {
|| 703 throw_not_found("RM '$rm' not found")
|| 704 # otherwise, just pass it up the chain
|| 705 } else {
|| 706 die $@;
|| 707 }
|| 708 }
|| 709
|| 710 return $output;
Something akin to the following resolves this issue.
|| 702 if(not ref $@ and $@ =~ /No such run mode/) {