Skip to content

Commit

Permalink
small optimizations
Browse files Browse the repository at this point in the history
  • Loading branch information
kraih committed Jan 31, 2013
1 parent ba7442f commit f020e9d
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion lib/Mojo/Content.pm
Expand Up @@ -72,7 +72,7 @@ sub is_chunked { !!shift->headers->transfer_encoding }

sub is_compressed { (shift->headers->content_encoding || '') =~ /^gzip$/i }

sub is_dynamic { $_[0]->{dynamic} && !defined $_[0]->headers->content_length }
sub is_dynamic { $_[0]{dynamic} && !defined $_[0]->headers->content_length }

sub is_finished { (shift->{state} // '') eq 'finished' }

Expand Down
2 changes: 1 addition & 1 deletion lib/Mojo/IOLoop/Server.pm
Expand Up @@ -109,7 +109,7 @@ sub start {
$self->{handle} => sub { $self->_accept for 1 .. $self->multi_accept });
}

sub stop { $_[0]->reactor->remove($_[0]->{handle}) }
sub stop { $_[0]->reactor->remove($_[0]{handle}) }

sub _accept {
my $self = shift;
Expand Down
2 changes: 1 addition & 1 deletion lib/Mojo/UserAgent.pm
Expand Up @@ -352,7 +352,7 @@ sub _handle {
}
}

sub _loop { $_[0]->{nb} ? Mojo::IOLoop->singleton : $_[0]->ioloop }
sub _loop { $_[0]{nb} ? Mojo::IOLoop->singleton : $_[0]->ioloop }

sub _read {
my ($self, $id, $chunk) = @_;
Expand Down
6 changes: 3 additions & 3 deletions lib/Mojolicious/Renderer.pm
Expand Up @@ -26,9 +26,9 @@ sub new {
my $self = shift->SUPER::new(@_);

$self->add_handler(
json => sub { ${$_[2]} = Mojo::JSON->new->encode($_[3]->{json}) });
$self->add_handler(data => sub { ${$_[2]} = $_[3]->{data} });
$self->add_handler(text => sub { ${$_[2]} = $_[3]->{text} });
json => sub { ${$_[2]} = Mojo::JSON->new->encode($_[3]{json}) });
$self->add_handler(data => sub { ${$_[2]} = $_[3]{data} });
$self->add_handler(text => sub { ${$_[2]} = $_[3]{text} });

return $self;
}
Expand Down

0 comments on commit f020e9d

Please sign in to comment.