[Jifty-commit] r5340 - in Net-Jifty: .

Jifty commits jifty-commit at lists.jifty.org
Mon Apr 28 15:48:18 EDT 2008


Author: sartak
Date: Mon Apr 28 15:48:17 2008
New Revision: 5340

Modified:
   Net-Jifty/   (props changed)
   Net-Jifty/lib/Net/Jifty.pm

Log:
 r54523 at onn:  sartak | 2008-04-28 15:48:09 -0400
 Allow multiple arguments of the same name. Jifty doesn't seem to support it but at least we're forward-compatible


Modified: Net-Jifty/lib/Net/Jifty.pm
==============================================================================
--- Net-Jifty/lib/Net/Jifty.pm	(original)
+++ Net-Jifty/lib/Net/Jifty.pm	Mon Apr 28 15:48:17 2008
@@ -293,10 +293,9 @@
 
 sub form_url_encoded_args {
     my $self = shift;
-    my %args = @_;
 
     my $uri = '';
-    while (my ($key, $value) = each %args) {
+    while (my ($key, $value) = splice @_, 0, 2) {
         $uri .= join('=', map { $self->escape($_) } $key, $value) . '&';
     }
     chop $uri;
@@ -324,7 +323,7 @@
     my $self   = shift;
     my $method = lc(shift);
     my $url    = shift;
-    my %args   = @_;
+    my @args   = @_;
 
     $url = $self->join_url(@$url)
         if ref($url) eq 'ARRAY';
@@ -337,8 +336,8 @@
     my $res;
 
     if ($method eq 'get' || $method eq 'head') {
-        $uri .= '?' . $self->form_url_encoded_args(%args)
-            if keys %args;
+        $uri .= '?' . $self->form_url_encoded_args(@args)
+            if @args;
 
         $res = $self->ua->$method($uri);
     }
@@ -347,8 +346,8 @@
             uc($method) => $uri,
         );
 
-        if (keys %args) {
-            my $content = $self->form_url_encoded_args(%args);
+        if (@args) {
+            my $content = $self->form_url_encoded_args(@args);
             $req->header('Content-type' => 'application/x-www-form-urlencoded');
             $req->content($content);
         }


More information about the Jifty-commit mailing list