Skip to content

Commit

Permalink
use eval idiom consistently
Browse files Browse the repository at this point in the history
  • Loading branch information
kraih committed Nov 13, 2013
1 parent 9325424 commit f8b4ce6
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions lib/Mojo/Server/Prefork.pm
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions lib/Mojo/Template.pm
Expand Up @@ -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);
Expand Down

0 comments on commit f8b4ce6

Please sign in to comment.