summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJason Woodward2010-06-25 00:07:29 -0400
committerJason Woodward2010-06-25 00:07:29 -0400
commit60d22e21efeb14eeb6264fe0d35f117b99e6399d (patch)
tree5de6e4106403b84fa4e61d3f1b818601c34f9f2a
parent828c70a25aa47a6a55ddb92cec6b2d37d1b72e85 (diff)
downloadJaos-WebApp-60d22e21efeb14eeb6264fe0d35f117b99e6399d.tar.gz
handle lack of [pre|post]_dispatch hooks
-rw-r--r--Changes3
-rw-r--r--lib/Jaos/WebApp.pm4
2 files changed, 4 insertions, 3 deletions
diff --git a/Changes b/Changes
index 80e6ce9..b0f6a6f 100644
--- a/Changes
+++ b/Changes
@@ -1,5 +1,6 @@
-0.3 June 17, 2010
+0.3 June 25, 2010
+ * handle lack of [pre|post]_dispatch hooks
* added redirect_external to ::Controller
* auto set the secure cookie flag if using SSL
* updated error reporting when loading packages or dispatching
diff --git a/lib/Jaos/WebApp.pm b/lib/Jaos/WebApp.pm
index 096f4ff..690fb02 100644
--- a/lib/Jaos/WebApp.pm
+++ b/lib/Jaos/WebApp.pm
@@ -75,7 +75,7 @@ sub run
# pre dispatch hook here
$self->log->debug("running pre dispatch hooks");
- $_->($self) for @{$self->{run_hooks}->{pre_dispatch}};
+ $_->($self) for @{$self->{run_hooks}->{pre_dispatch} || []};
eval {
if (my $rule = $self->{dispatcher}->match($self)) {
@@ -100,7 +100,7 @@ sub run
# post dispatch hook here
$self->log->debug("running post dispatch hooks");
- $_->($self) for reverse @{$self->{run_hooks}->{post_dispatch}};
+ $_->($self) for reverse @{$self->{run_hooks}->{post_dispatch} || []};
delete $self->{ qw/stash res req/};
return $res->finalize;