Navigation Menu

Skip to content

Commit

Permalink
use more Perl 5.10 features
Browse files Browse the repository at this point in the history
  • Loading branch information
kraih committed Oct 17, 2011
1 parent 2aab61d commit d045691
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions lib/Mojo/UserAgent/Transactor.pm
Expand Up @@ -188,7 +188,7 @@ sub redirect {
# Commonly used codes
my $res = $old->res;
my $code = $res->code || 0;
return unless $code == 301 || $code == 302 || $code == 303 || $code == 307;
return unless $code ~~ [301, 302, 303, 307];

# Fix broken location without authority and/or scheme
return unless my $location = $res->headers->location;
Expand All @@ -201,7 +201,7 @@ sub redirect {
# Clone request if necessary
my $new = Mojo::Transaction::HTTP->new;
my $method = $req->method;
if ($code == 301 || $code == 307) {
if ($code ~~ [301, 307]) {
return unless $req = $req->clone;
$new->req($req);
my $headers = $req->headers;
Expand Down
4 changes: 2 additions & 2 deletions lib/Mojolicious/Routes/Pattern.pm
Expand Up @@ -76,7 +76,7 @@ sub render {
}

# Relaxed, symbol or wildcard
elsif ($op eq 'relaxed' || $op eq 'symbol' || $op eq 'wildcard') {
elsif ($op ~~ [qw/relaxed symbol wildcard/]) {
my $name = $token->[1];
$rendered = $values->{$name} // '';
my $default = $self->defaults->{$name};
Expand Down Expand Up @@ -161,7 +161,7 @@ sub _compile {
}

# Symbol
elsif ($op eq 'relaxed' || $op eq 'symbol' || $op eq 'wildcard') {
elsif ($op ~~ [qw/relaxed symbol wildcard/]) {
my $name = $token->[1];
unshift @{$self->symbols}, $name;

Expand Down

0 comments on commit d045691

Please sign in to comment.