From ef944e4b6943146edf5a1bc2e56b4dc89ad136ca Mon Sep 17 00:00:00 2001 From: franck cuny Date: Tue, 11 May 2010 16:01:28 +0200 Subject: replace remainging with nothing --- lib/MooseX/Net/API.pm | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'lib') 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!/^! ); -- cgit 1.4.1