Skip to content

Commit

Permalink
small optimization
Browse files Browse the repository at this point in the history
  • Loading branch information
kraih committed Apr 5, 2012
1 parent fbf2ddb commit 1ea7c4c
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
6 changes: 3 additions & 3 deletions lib/Mojo/IOLoop.pm
Expand Up @@ -177,9 +177,6 @@ sub stream {
my $self = shift;
$self = $self->singleton unless ref $self;

# Make sure garbage gets collected
$self->_cleaner;

# Connect stream with reactor
my $stream = shift;
return $self->_stream($stream, $self->_id) if blessed $stream;
Expand Down Expand Up @@ -275,6 +272,9 @@ sub _remove {
sub _stream {
my ($self, $stream, $id) = @_;

# Make sure garbage gets collected
$self->_cleaner;

# Connect stream with reactor
$self->{connections}->{$id}->{stream} = $stream;
weaken $stream->reactor($self->reactor)->{reactor};
Expand Down
2 changes: 1 addition & 1 deletion lib/Mojo/UserAgent/Transactor.pm
Expand Up @@ -163,7 +163,7 @@ sub tx {
ref $url ? $req->url($url) : $req->url->parse($url);

# Body
$req->body(pop @_)
$req->body(pop)
if @_ & 1 == 1 && ref $_[0] ne 'HASH' || ref $_[-2] eq 'HASH';

# Headers
Expand Down
4 changes: 2 additions & 2 deletions lib/Mojolicious/Plugin/TagHelpers.pm
Expand Up @@ -210,7 +210,7 @@ sub register {
my ($c, $name) = (shift, shift);

# Content
my $cb = ref $_[-1] eq 'CODE' ? pop @_ : sub {''};
my $cb = ref $_[-1] eq 'CODE' ? pop : sub {''};
my $content = @_ % 2 ? shift : undef;

# Make sure content is wrapped
Expand Down Expand Up @@ -261,7 +261,7 @@ sub _tag {
my ($self, $name) = (shift, shift);

# Content
my $cb = ref $_[-1] eq 'CODE' ? pop @_ : undef;
my $cb = ref $_[-1] eq 'CODE' ? pop : undef;
my $content = @_ % 2 ? pop : undef;

# Start tag
Expand Down

0 comments on commit 1ea7c4c

Please sign in to comment.