diff options
Diffstat (limited to 'lib/MooseX/Net')
-rw-r--r-- | lib/MooseX/Net/API.pm | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/lib/MooseX/Net/API.pm b/lib/MooseX/Net/API.pm index 1587810..872d83d 100644 --- a/lib/MooseX/Net/API.pm +++ b/lib/MooseX/Net/API.pm @@ -207,11 +207,17 @@ sub net_api_method { my $path = $options{path}; # replace all args in the url - while ( $path =~ /\$(\w+)/g ) { + my $max_iter = keys %args; + my $i = 0; + while ($path =~ /\$(\w+)/g) { my $match = $1; - if ( my $value = delete $args{$match} ) { + if (my $value = delete $args{$match}) { $path =~ s/\$$match/$value/; } + if (++$i > $max_iter) { + $path =~ s/\$(\w+)//; + last; + } } $path .= '/' if ( $self->api_base_url !~ m!/^! ); |