Created
November 11, 2009 18:01
-
-
Save lolicsystem/232151 to your computer and use it in GitHub Desktop.
anktagcloud.pl -- Ank Pixiv Tool で取得した絵のタグから、自分の性癖を知るためのスクリプト
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/perl | |
use strict; | |
use warnings; | |
use DBI; | |
use feature ":5.10"; | |
my $dbh = DBI->connect("dbi:SQLite:dbname=ankpixiv.sqlite", | |
undef, | |
undef, | |
{ | |
AutoCommit => 0, | |
RaiseError => 1, | |
}); | |
my %count; | |
eval { | |
my $ary_ref = $dbh->selectall_arrayref("SELECT tags FROM histories;"); | |
for my $row (@$ary_ref) { | |
for (split ' ', $row->[0]) { | |
$count{$_}++; | |
} | |
} | |
}; | |
if ($@) { | |
$dbh->disconnect; | |
die "Error: $@"; | |
} | |
$dbh->disconnect or warn $!; | |
say "$count{$_}\t$_" for (sort {$count{$b} <=> $count{$a}} keys %count); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment