Skip to content

Commit

Permalink
use @_ only for one-liners
Browse files Browse the repository at this point in the history
  • Loading branch information
kraih committed Feb 16, 2015
1 parent f20bb22 commit 158d4ef
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
3 changes: 2 additions & 1 deletion lib/Mojo/Collection.pm
Expand Up @@ -12,7 +12,8 @@ our @EXPORT_OK = ('c');
sub c { __PACKAGE__->new(@_) }

sub compact {
$_[0]->new(grep { defined && (ref || length) } @{$_[0]});
my $self = shift;
return $self->new(grep { defined && (ref || length) } @$self);
}

sub each {
Expand Down
10 changes: 6 additions & 4 deletions lib/Mojo/IOLoop.pm
Expand Up @@ -169,7 +169,9 @@ sub _id {
sub _instance { ref $_[0] ? $_[0] : $_[0]->singleton }

sub _limit {
$_[0]{stop} || keys %{$_[0]{connections}} >= $_[0]->max_connections;
my $self = shift;
return 1 if $self->{stop};
return keys %{$self->{connections}} >= $self->max_connections;
}

sub _maybe_accepting {
Expand All @@ -179,9 +181,9 @@ sub _maybe_accepting {
return if $self->{accepting} || $self->_limit;

# Check if multi-accept is desirable
my $m = $self->multi_accept;
$m = 1 if $self->max_connections < $m;
$_->multi_accept($m)->start for values %{$self->{acceptors} || {}};
my $multi = $self->multi_accept;
$multi = 1 if $self->max_connections < $multi;
$_->multi_accept($multi)->start for values %{$self->{acceptors} || {}};
$self->{accepting} = 1;
}

Expand Down

0 comments on commit 158d4ef

Please sign in to comment.