Skip to content

Commit

Permalink
clone Mojo::URL a little faster
Browse files Browse the repository at this point in the history
  • Loading branch information
kraih committed Aug 16, 2014
1 parent a6b3b06 commit 6b1b53a
Showing 1 changed file with 3 additions and 7 deletions.
10 changes: 3 additions & 7 deletions lib/Mojo/URL.pm
Expand Up @@ -41,14 +41,10 @@ sub host_port {
}

sub clone {
my $self = shift;

my $self = shift;
my $clone = $self->new;
map { $clone->{$_} = $self->{$_} } qw(scheme userinfo host port fragment);
$clone->{path} = $self->path->clone;
$clone->{query} = $self->query->clone;
if (my $base = $self->{base}) { $clone->{base} = $base->clone }

@$clone{keys %$self} = values %$self;
$clone->{$_} && ($clone->{$_} = $clone->{$_}->clone) for qw(base path query);
return $clone;
}

Expand Down

0 comments on commit 6b1b53a

Please sign in to comment.