Permalink
Browse files

use eval idiom consistently

  • Loading branch information...
kraih committed Nov 13, 2013
1 parent 9325424 commit f8b4ce66f3d3eecde8cc6d265055a1e9cbae7588
Showing with 4 additions and 4 deletions.
  1. +2 −2 lib/Mojo/Server/Prefork.pm
  2. +2 −2 lib/Mojo/Template.pm
@@ -182,8 +182,8 @@ sub _spawn {
my $old = Time::HiRes::ualarm $self->lock_timeout * 1000000;
$lock = flock $handle, LOCK_EX;
Time::HiRes::ualarm $old;
- };
- if ($@) { $lock = $@ eq "alarm\n" ? 0 : die($@) }
+ 1;
+ } or $lock = $@ eq "alarm\n" ? 0 : die $@;
}
# Non blocking
View
@@ -118,8 +118,8 @@ sub interpret {
};
return undef unless my $compiled = $self->compiled;
- my $output = eval { $compiled->(@_) };
- return $output unless $@;
+ my $output;
+ return $output if eval { $output = $compiled->(@_); 1 };
# Exception with template context
return Mojo::Exception->new($@, [$self->template])->verbose(1);

0 comments on commit f8b4ce6

Please sign in to comment.