Skip to content

Commit

Permalink
small optimizations
Browse files Browse the repository at this point in the history
  • Loading branch information
kraih committed Aug 2, 2014
1 parent 4b01d87 commit aa003af
Showing 1 changed file with 3 additions and 9 deletions.
12 changes: 3 additions & 9 deletions lib/Mojo/Message.pm
Expand Up @@ -140,15 +140,9 @@ sub json {
}

sub links {
my $self = shift;

my %links;
for my $link (@{split_header $self->headers->link // '', \&_link}) {
my $hash = {url => (splice @$link, 0, 2)[0], @$link};
$links{$hash->{rel}} = $hash;
}

return \%links;
my $links = split_header shift->headers->link // '', \&_link;
my @links = map { {url => (splice @$_, 0, 2)[0], @$_} } @$links;
return {map { $_->{rel} => $_ } @links};
}

sub param { shift->body_params->param(@_) }
Expand Down

0 comments on commit aa003af

Please sign in to comment.