Permalink
Browse files

small optimizations

  • Loading branch information...
kraih committed Nov 13, 2013
1 parent f8b4ce6 commit 37b3b00e2e363f0e89931827baf2eedbe216d1d7
Showing with 2 additions and 5 deletions.
  1. +2 −5 lib/Mojo/Date.pm
View
@@ -42,11 +42,8 @@ sub parse {
else { return $self }
# Prevent crash
- my $epoch;
- $epoch = eval { timegm($s, $m, $h, $day, $month, $year) };
- $self->epoch($epoch) if !$@ && $epoch >= 0;
-
- return $self;
+ my $epoch = eval { timegm($s, $m, $h, $day, $month, $year) };
+ return defined $epoch && $epoch >= 0 ? $self->epoch($epoch) : $self;
}
sub to_string {

0 comments on commit 37b3b00

Please sign in to comment.