Skip to content

Instantly share code, notes, and snippets.

@semifor
Created August 26, 2009 21:03
Show Gist options
  • Save semifor/175841 to your computer and use it in GitHub Desktop.
Save semifor/175841 to your computer and use it in GitHub Desktop.
diff --git a/lib/Net/Twitter/Core.pm b/lib/Net/Twitter/Core.pm
index 3011089..bf3c6c2 100644
--- a/lib/Net/Twitter/Core.pm
+++ b/lib/Net/Twitter/Core.pm
@@ -86,7 +86,7 @@ sub _authenticated_request {
my $msg;
- $_ = encode('utf-8', $_) for keys %$args, values %$args;
+ $args = { map { encode('utf-8', $_) } %$args };
if ( $http_method eq 'GET' ) {
$uri->query_form($args);
diff --git a/lib/Net/Twitter/Role/OAuth.pm b/lib/Net/Twitter/Role/OAuth.pm
index 3c6249c..29dac1b 100644
--- a/lib/Net/Twitter/Role/OAuth.pm
+++ b/lib/Net/Twitter/Role/OAuth.pm
@@ -181,7 +181,7 @@ override _authenticated_request => sub {
}
elsif ( $http_method eq 'POST' ) {
delete $args->{source}; # not necessary with OAuth requests
- $_ = encode('utf-8', $_) for keys %$args, values %$args;
+ $args = { map { encode('utf-8', $_) } %$args };
$msg = POST($uri, $args);
}
else {
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment