Skip to content

Commit

Permalink
no need to create a closure every time
Browse files Browse the repository at this point in the history
  • Loading branch information
kraih committed Aug 2, 2014
1 parent fb1d3ae commit 4b01d87
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions lib/Mojo/Message.pm
Expand Up @@ -143,8 +143,7 @@ sub links {
my $self = shift;

my %links;
my $cb = sub { ${$_[0]} =~ s/^\s*<(.+?)>// ? ($1, undef) : () };
for my $link (@{split_header $self->headers->link // '', $cb}) {
for my $link (@{split_header $self->headers->link // '', \&_link}) {
my $hash = {url => (splice @$link, 0, 2)[0], @$link};
$links{$hash->{rel}} = $hash;
}
Expand Down Expand Up @@ -269,6 +268,8 @@ sub _limit {
return $self->error({message => $msg, advice => $code});
}

sub _link { ${$_[0]} =~ s/^\s*<(.+?)>// ? ($1, undef) : () }

sub _parse_formdata {
my ($self, $upload) = @_;

Expand Down

0 comments on commit 4b01d87

Please sign in to comment.