-
-
Save anonymous/7ef516a683456225676c to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/lib/Mojo/Parameters.pm b/lib/Mojo/Parameters.pm | |
index 46c48a9..b79fda9 100644 | |
--- a/lib/Mojo/Parameters.pm | |
+++ b/lib/Mojo/Parameters.pm | |
@@ -32,8 +32,8 @@ sub clone { | |
my $self = shift; | |
my $clone = $self->new->charset($self->charset); | |
- if (defined $self->{string}) { $clone->{string} = $self->{string} } | |
- else { $clone->params([@{$self->params}]) } | |
+ if (defined $self->{string}) { $clone->{string} = $self->{string} } | |
+ else { $clone->{params} = [@{$self->params}] } | |
return $clone; | |
} | |
diff --git a/lib/Mojo/URL.pm b/lib/Mojo/URL.pm | |
index e025194..3420b49 100644 | |
--- a/lib/Mojo/URL.pm | |
+++ b/lib/Mojo/URL.pm | |
@@ -44,9 +44,11 @@ sub clone { | |
my $self = shift; | |
my $clone = $self->new; | |
- $clone->$_($self->$_) for qw(scheme userinfo host port fragment); | |
- $clone->path($self->path->clone)->query($self->query->clone); | |
- $clone->base($self->base->clone) if $self->{base}; | |
+ my @keys = qw(scheme userinfo host port fragment); | |
+ @$clone{@keys} = @$self{@keys}; | |
+ $clone->{path} = $self->path->clone; | |
+ $clone->{query} = $self->query->clone; | |
+ if (my $base = $self->{base}) { $clone->{base} = $base->clone } | |
return $clone; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment