note
Lady_Aleena
<p>Maybe if I showed some of the scripts where the data is used, maybe some pointers can be given on where my mind should be if I decide to try again with OO for the data.</p>
<p><b><c>list_links.pl</c></b></p>
<p><c>list_links</c> sends HTML list items <c><li></c> to the clip board so I can paste them into a [href://http://tmblr.co/ZZVoswE7_RE1|Tumblr post] I update every once in a while to get more people to subscribe.</p>
<code>
#!/usr/bin/perl
use strict;
use warnings FATAL => qw( all );
use Lingua::EN::Inflect qw(NO);
use Win32::Clipboard;
use lib '../files/perl/lib';
use Twitter::ListSort qw(list_compare);
use Twitter::Data;
my %lists = Twitter::Data::all_lists; # This is all of the lists I keep across all my accounts.
my $board;
for my $list (sort { list_compare($a,$b) } values %lists) { # Starting the loop.
next if !grep(/owner/,@{$list->{status}});
my $targ = $list->{target};
my $link = $list->{link};
my $name = length($list->{long_name}) ? $list->{long_name} : $list->{name};
my $targ_text = $targ > 0 ? " (".NO('subscriber',$targ)." 'til target met)" : '';
my $asterisk = $list->{user} eq "Lady_Aleena" ? '*' : '';
$board .= qq(<li><a href="$link">$name</a>$asterisk$targ_text</li>\n);
}
my $clip = Win32::Clipboard();
$clip->Set($board);
</code>
<p><b><c>list_people.pl</c></b></p>
<p><c>list_people</c> does three things.</p>
<ol>
<li>It tells me who I have not made members of my [href://https://twitter.com/Lady_Aleena/list-subscribers|List subscribers] list. Anyone who subscribes to one of my lists becomes a member of List subscribers. I take this group and add them to List subscribers with another script. Sometimes removed or suspended Twitter accounts remain as subscribers of a list for months or even years. I check to make sure the account exists before trying to add it (or readd it) to the List subscribers list.</li>
<li>It tells me who is no longer subscribed to my lists who still remains on the List subscribers list. There is a way with [mod://Net::Twitter::Lite] to remove people from the list programmatically, I just have not added it to the script yet.</li>
<li>Since most of my accounts (not my main [href://https://twitter.com/Lady_Aleena|Lady_Aleena] account) were created to house lists, most (if not all) of the people followed by the account is either a member or subscriber to a list. This section checks to see if the account is following someone who is neither a list member or list subscriber. The first time I ran the script with this section, I ended up creating about eight new lists.</li>
</ol>
<code>
#!/usr/bin/perl
use strict;
use warnings FATAL => qw( all );
use Lingua::EN::Inflect qw(WORDLIST);
use Text::Table;
use Win32::Clipboard;
use lib '../files/perl/lib';
use Twitter::Data;
my @accounts = Twitter::Data::accounts;
my %lists = Twitter::Data::all_lists;
my %lists_people = Twitter::Data::lists_people;
my @subscribers = @{$lists{'72710881'}{members}};
local $\ = "\n";
# 1 above.
print 'Subscribers not on the list';
for my $subscriber (keys %{$lists_people{subscribers}}) {
my $s_lists = WORDLIST(@{$lists_people{subscribers}{$subscriber}}, {conj=>''});
print "$subscriber - $s_lists" if !grep($_ eq $subscriber,@subscribers);
}
print "\n";
# 2 above.
print 'Non-subscribers on the list';
for my $subscriber (@subscribers) {
print $subscriber if !$lists_people{subscribers}{$subscriber};
}
print "\n";
# 3 above
print 'People followed but not listed (by account)';
for my $account (@accounts) {
next if $account =~ /^(LadyAleena_(?:eros|test))$/;
my %account_people = Twitter::Data::acct_data($account,'people');
my @not_members;
for my $person (values %account_people) {
my $name = $person->{screen_name};
push @not_members, $name if ($person->{friends} == 1 && !$lists_people{members}{$name});
}
local $\ = "\n";
if (scalar(@not_members) > 0) {
print "$account";
for (sort {lc $a cmp lc $b} @not_members) {
$board .= "\t$_\n";
print "\t$_";
}
}
}
</code>
<p>If you see anything in there where OO would come in handy, let me know. These two scripts are probably the shortest of those I have written where I need the data.</p>
<div class="pmsig"><div class="pmsig-161890">
<div><strong><em>Have a cookie and a very nice day!</em></strong></div>
<div><em>Lady Aleena</em></div>
</div></div>
1016970
1017297