今回のSF出張の準備として電子辞書を買いましたが、 PCで作業中に英語で分からない単語があると アルクの英辞郎 に問い合わせることも多いです。
ふと、どんな単語を問い合わせているのかなぁと作ってみたのが以下のスクリプト
Firefox はプロフィールフォルダ以下にある history.dat というファイルにブラウザの表示履歴データ を保存しています。 保存しているデータは Mork とかいう変態フォーマット。しかし CPAN にはすでに File::Mork という モジュールが存在していて、そいつにデータ解析を任せることが出来ます。 後は取得した File::Mork::Entry を料理するだけです。
1 #!/usr/bin/perl 2 use strict; 3 use warnings; 4 5 use File::Mork; 6 use URI::Escape; 7 use Encode; 8 use Getopt::Long; 9 10 my %map = (atime => 'LastVisitDate', 11 ctime => 'FirstVisitDate', 12 count => 'VisitCount'); 13 14 my $word_in_re = qr/([^&]+)/; 15 my $ejr_re = quotemeta('http://www2.alc.co.jp/ejr/index.php?word_in=') 16 . $word_in_re; 17 18 my $file; 19 my $sort = 'atime'; 20 GetOptions ("file=s" => \$file, 21 "sort=s" => \$sort); 22 23 unless ($file and $map{$sort}) { 24 print "Usage: $0 --file histroy.dat [--sort atime|ctime|count]\n\n"; 25 exit; 26 } 27 28 my $mork = File::Mork->new($file, verbose => 1) 29 or die $File::Mork::ERROR."\n"; 30 31 31 32 my $key = $map{$sort}; 33 for my $entry ( sort {$b->{$key} <=> $a->{$key}} 34 map {$_->{$key} = 0 unless $_->{$key}; $_} 35 $mork->entries ) { 36 37 next unless $entry->{URL} and $entry->{URL} =~ /^$ejr_re/; 38 my $word_in = $1; 39 40 $word_in = uri_unescape($word_in); 41 42 Encode::from_to($word_in, 'Shift_JIS', 'utf-8') 43 if $^O ne 'MSWin32' and $word_in =~ /[^[:ascii:]]/ ; 44 45 $entry->{VisitCount} = 0 unless $entry->{VisitCount}; 46 print join("\t", $entry->{VisitCount}, $word_in), "\n"; 47 } 48 49 1; 50

2 Comments
というか、アルクの英辞郎にクエリーにいくようなツールバー(&右クリック)を作ってくだされ。お願いします。
http://tanimo.to/mt/archives/2005/12/firefox_1.html
firefox のアドレスバーに「eijiro 梅干し」と入れると英辞郎へ行く方法が紹介されています。(って、tanimo.to さんに教えてあげたのが僕ですが)