summary refs log tree commit diff
diff options
context:
space:
mode:
authorfranck cuny <franck@lumberjaph.net>2010-05-11 16:01:28 +0200
committerfranck cuny <franck@lumberjaph.net>2010-05-11 16:01:28 +0200
commitef944e4b6943146edf5a1bc2e56b4dc89ad136ca (patch)
tree3373e04e3d0aed3dd84ea31747f8aac3f6bad328
parentfix infinite loop (diff)
downloadmoosex-net-api-ef944e4b6943146edf5a1bc2e56b4dc89ad136ca.tar.gz
replace remainging with nothing
-rw-r--r--lib/MooseX/Net/API.pm10
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!/^! );