Subject: | new feature: post_run_hook (patch included) |
I've added a new features which allows to define a 'post_run_hook' in the config (static => {
post_run_hook = 'xyz' } ) which will be called after a static file has been served. I use this to
forward to a private method in my Root controller which sets some special response headers for
caching. Maybe this is useful for others too, so I applied a patch for v0.29. Thanks - Marc
Subject: | Static-Simple.patch |
--- /usr/local/lib/perl5/site_perl/5.10.1/Catalyst/Plugin/Static/Simple.pm 2010-05-03 08:11:38.403225099 +0000
+++ Catalyst/Plugin/Static/Simple.pm 2010-05-03 11:52:31.253752367 +0000
@@ -185,6 +185,13 @@ sub _serve_static {
if ( defined $fh ) {
binmode $fh;
$c->res->body( $fh );
+
+ if ($c->config->{static}{debug} && $c->config->{static}{post_run_hook}) {
+
+ $c->_debug_msg( "-> Running post_run_hook " . $c->config->{static}{post_run_hook} );
+
+ $c->forward( $c->config->{static}{post_run_hook} );
+ }
}
else {
Catalyst::Exception->throw(