Skip to content

Commit

Permalink
small optimizations
Browse files Browse the repository at this point in the history
  • Loading branch information
kraih committed Oct 28, 2013
1 parent c511a28 commit f43a31d
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion lib/Mojo/DOM/CSS.pm
Expand Up @@ -210,7 +210,7 @@ sub _parent {
my ($self, $selectors, $current, $tree) = @_;
return undef unless my $parent = $current->[3];
return undef if $parent->[0] eq 'root';
return $self->_combinator($selectors, $parent, $tree) ? 1 : undef;
return $self->_combinator($selectors, $parent, $tree);
}

sub _pc {
Expand Down
6 changes: 3 additions & 3 deletions lib/Mojo/Path.pm
Expand Up @@ -119,9 +119,9 @@ sub _parse {
my $path = url_unescape delete($self->{path}) // '';
my $charset = $self->charset;
$path = decode($charset, $path) // $path if $charset;
$self->{leading_slash} = $path =~ s!^/!! ? 1 : undef;
$self->{trailing_slash} = $path =~ s!/$!! ? 1 : undef;
$self->{parts} = [split '/', $path, -1];
$self->{leading_slash} = $path =~ s!^/!!;
$self->{trailing_slash} = $path =~ s!/$!!;
$self->{parts} = [split '/', $path, -1];
}

return $self->{$name} unless @_;
Expand Down
2 changes: 1 addition & 1 deletion lib/Mojo/Server/Daemon.pm
Expand Up @@ -172,7 +172,7 @@ sub _listen {
my $verify = $query->param('verify');
$options->{tls_verify} = hex $verify if defined $verify;
delete $options->{address} if $options->{address} eq '*';
my $tls = $options->{tls} = $url->protocol eq 'https' ? 1 : undef;
my $tls = $options->{tls} = $url->protocol eq 'https';

weaken $self;
push @{$self->acceptors}, $self->ioloop->server(
Expand Down
2 changes: 1 addition & 1 deletion lib/Mojolicious/Plugin/HeaderCondition.pm
Expand Up @@ -15,7 +15,7 @@ sub _check {
my ($value, $pattern) = @_;
return 1
if $value && $pattern && ref $pattern eq 'Regexp' && $value =~ $pattern;
return $value && defined $pattern && $pattern eq $value ? 1 : undef;
return $value && defined $pattern && $pattern eq $value;
}

sub _headers {
Expand Down
2 changes: 1 addition & 1 deletion lib/Mojolicious/Plugins.pm
Expand Up @@ -55,7 +55,7 @@ sub _load {
if (my $e = Mojo::Loader->new->load($module)) {
ref $e ? die $e : return undef;
}
return $module->isa('Mojolicious::Plugin') ? 1 : undef;
return $module->isa('Mojolicious::Plugin');
}

1;
Expand Down

0 comments on commit f43a31d

Please sign in to comment.