Skip to content

Instantly share code, notes, and snippets.

Keybase proof

I hereby claim:

  • I am semifor on github.
  • I am semifor (https://keybase.io/semifor) on keybase.
  • I have a public key whose fingerprint is 2DFB 3643 FA94 E02F 0A68 DA27 D32B C82B 2740 B9FD

To claim this, I am signing this object:

# For some reason, this was raising hell after adding
# use namespace::autoclean;
my $percent_captions = sub {
my @left = @_[ 0 .. $#_ - 1 ];
my @right = @_[ 1 .. $#_ ];
return "< $_[0]%", pairwise {"$a to $b%"} @left, @right;
};
my @pcts = ( 1, 5, 10, 25, 50, 75, 100 );
my @pct_captions = $percent_captions->(@pcts);
# $ tweet Hi mom!
#
# Put this in ~/.bashrc or wherever.
# If it doesn't work, make sure your ~/.netrc is right
#
# The Perl version
tweet() {
perl -MNet::Twitter::Lite -E'say Net::Twitter::Lite->new(ssl=>1,netrc=>1)->update("@ARGV")->{id}' $*
}
#!/usr/bin/perl
use warnings;
use strict;
use lib qw/lib/;
use Test::More tests => 41;
#------------------------------- Object::Simple -------------------------------
use Object::Simple;
my $o = Object::Simple->new(1);
#!/usr/bin/perl
# Net::Twitter - decoded character vs. encoded byte example
use warnings;
use strict;
use utf8;
# This program produced the following:
#
# http://twitter.com/semifor_test/status/2910290982
# http://twitter.com/semifor_test/status/2910312937
$ git push --tags origin master
Counting objects: 32, done.
Delta compression using up to 2 threads.
Compressing objects: 100% (16/16), done.
Writing objects: 100% (17/17), 1.52 KiB, done.
Total 17 (delta 12), reused 0 (delta 0)
error: file write error (No space left on device)
fatal: unable to write sha1 file
error: unpack failed: unpacker exited with error code
To git@github.com:semifor/Net-Twitter.git
#!/usr/bin/perl
# Accessing the HTTP::Response object on successful Net::Twitter API calls
use warnings;
use strict;
use Net::Twitter;
my $nt = Net::Twitter->new(netrc => 1, legacy => 0);
my $response;
diff --git a/lib/Net/Twitter/Core.pm b/lib/Net/Twitter/Core.pm
index f52207c..3011089 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 values %$args;
+ $_ = encode('utf-8', $_) for keys %$args, values %$args;
#!/usr/bin/perl
use strict;
use warnings;
use utf8;
use Encode qw/encode_utf8/;
use Net::Twitter;
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 };