Catalyst::Plugin::MortalForward - Make forward() to throw exception
use Catalyst qw( MortalForward ); sub someaction : Local { ... $c->forward('check_input'); # may die # never executed if forward dies do_something_important(); # assume that the input has been checked }
Catalyst::Plugin::MortalForward is a small plugin that changes the behaviour of $c->forward which usually never dies (because the forwarded code is internally wrapped into an eval block.
$c->forward
This plugin changes this behaviour globally. The forward method will throw exceptions (that you should be carefull to handle at somepoint or the default Catalyst error page will be displayed)
Discussion on the Catalyst mailing list: http://lists.rawmode.org/pipermail/catalyst/2006-January/004874.html (followed-up in February)
Please report any problem. If you let the exception reach Catalyst internal, then the error (which is logged might be a bit messy) because it holds the information of all successive layers that the exception went thru. For instance :
Caught exception in TestApp->class_fwd "Caught exception in TestApp::C::Elsewhere->test "I die too, sorry at /Users/yann/Catalyst/Catalyst-Plugin-MortalForward/t/lib/TestApp/C/Elsewhere.pm line 8." at lib/Catalyst/Plugin/MortalForward.pm line 24."
Six Apart, cpan@sixapart.com
Catalyst::Plugin::MortalForward is free software; you may redistribute it and/or modify it under the same terms as Perl itself.
Except where otherwise noted, Catalyst::Plugin::MortalForward is Copyright 2006 Six Apart, cpan@sixapart.com. All rights reserved.
To install Catalyst::Plugin::MortalForward, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Catalyst::Plugin::MortalForward
CPAN shell
perl -MCPAN -e shell install Catalyst::Plugin::MortalForward
For more information on module installation, please visit the detailed CPAN module installation guide.