]> Dogcows Code - chaz/p5-CGI-Ex/blobdiff - lib/CGI/Ex/App.pm
CGI::Ex 2.05
[chaz/p5-CGI-Ex] / lib / CGI / Ex / App.pm
index 313baf443e4d25e47be64591390dd0c66b205ba1..4a62f920b390b9228abc345090b23c1429e0415b 100644 (file)
@@ -10,7 +10,7 @@ use strict;
 use vars qw($VERSION);
 
 BEGIN {
-    $VERSION = '2.01';
+    $VERSION = '2.05';
 
     Time::HiRes->import('time') if eval {require Time::HiRes};
 }
@@ -382,6 +382,8 @@ sub run_hook {
     my ($code, $found) = @{ $self->find_hook($hook, $step) };
     if (! $code) {
         croak "Could not find a method named ${step}_${hook} or ${hook}";
+    } elsif (! UNIVERSAL::isa($code, 'CODE')) {
+        croak "Value for $hook ($found) is not a code ref ($code)";
     }
 
     ### record history
@@ -757,15 +759,17 @@ sub print {
 sub print_out {
     my ($self, $step, $out) = @_;
 
-    $self->cgix->print_content_type();
+    $self->cgix->print_content_type;
     print $out;
 }
 
 sub swap_template {
     my ($self, $step, $file, $swap) = @_;
 
-    require CGI::Ex::Template;
     my $args = $self->run_hook('template_args', $step);
+    $args->{'INCLUDE_PATH'} ||= sub { $self->base_dir_abs || die "Could not find base_dir_abs while looking for template INCLUDE_PATH on step \"$step\"" };
+
+    require CGI::Ex::Template;
     my $t = CGI::Ex::Template->new($args);
 
     my $out = '';
@@ -774,13 +778,7 @@ sub swap_template {
     return $out;
 }
 
-sub template_args {
-    my $self = shift;
-    my $step = shift;
-    return {
-        INCLUDE_PATH => sub { $self->base_dir_abs || die "Could not find base_dir_abs while looking for template INCLUDE_PATH on step \"$step\"" },
-    };
-}
+sub template_args { {} }
 
 sub fill_template {
     my ($self, $step, $outref, $fill) = @_;
@@ -936,9 +934,9 @@ sub hash_validation {
       if (ref($file) && ! UNIVERSAL::isa($file, 'SCALAR')) {
           $hash = $file;
 
-      ### read the file - if it fails - errors should be in the webserver error logs
+      ### read the file - if it is not found, errors will be in the webserver logs (all else dies)
       } elsif ($file) {
-          $hash = eval { $self->vob->get_validation($file) } || {};
+          $hash = $self->vob->get_validation($file) || {};
 
       } else {
           $hash = {};
This page took 0.02544 seconds and 4 git commands to generate.