/ Published in: Perl
This report looks at the most recent Tweet from each person in your friends list and keeps track of which client they're using. It then prints out a report showing how many people use each client, with the most popular at the bottom.
Code is written to be run via the command line, but could be adapted to other uses.
Requires Net::Twitter, which is available via CPAN.
Code is written to be run via the command line, but could be adapted to other uses.
Requires Net::Twitter, which is available via CPAN.
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
#!/usr/local/bin/perl use strict; use Net::Twitter; use Getopt::Std; my %options = (); getopts('u:p:',\%options); my $twitter = Net::Twitter->new( username => $options{u}, password => $options{p}, ); if ( ! $options{u} || ! $options{p} ) { } my $verification = $twitter->verify_credentials(); my %clients = (); my $friends = $twitter->friends(); foreach my $friend ( @{$friends} ) { $clients{$friend->{'status'}->{'source'}}++; } }