While the real strength of the Atom effort is the API and its unified format, retreiving feeds over HTTP and consuming their contents, similar like with RSS, will be a common use. The module endeavors to provide developers with a package that is simple, lightweight and easy install.
Atom フィードを料理するための lightweight な実装。今のところ各エレメントの取得に XPath を使うためのインタフェースが提供されています。
サンプルのコードまんまですが、
#!/usr/local/bin/perl
use strict;
use warnings;
use XML::Atom::Syndication;
use Encode;
my $atom = XML::Atom::Syndication->instance;
my $doc = $atom->get('http://naoya.dyndns.org/~naoya/mt/atom-03.xml');
for my $entry ($doc->query('//entry')) {
print encode('euc-jp', $entry->query('title')->text_value),"\n";
}
とすると
[naoya@judy XML-Atom-Syndication]$ perl sample.pl 変な検索語句の組み合わせ Gree Blog / Gree Night 1.0 Amazon 出資の検索サービス A9.com 行動力のある人 技術をプレゼンするのも能力 早瀬久美さんのウェブログ 東京 海外RSS最新動向と FeedBurner コメントスパム、来ず 松井爆発 MONSTER のアニメがやっている Hacking the Hack: MT コメントSPAM Blacklist ファイル更新 知人の日記を通じて人との出会いについて考える iNTERNET magazine 5月号、事件簿とSEO連載がイイ あるウェブアプリを見せたとき
といった具合でフィードを Hack できる。いいかも。中で XML::Parser を使っているので、取得したテキストは UTF-8 フラグが立っているのは XML::RSS などと同じ。
Timothy Appnel さんは Net::TrackBack や XML::RAI なんかも作っている人。