前回のエントリ 「Perlで日付・時間操作 - DateTime モジュールの使い方」で書いたとおり、とっても便利なDateTimeモジュールですが、強いて難点をあげるとすれば、必要な依存モジュールが多いこと = インストールが面倒くさい事かと個人的には思います。shell と make コマンドが使える環境ならば、"$ perl -MCPAN -e 'install DateTime' " で自動インストールしちゃえるのですが、これができない状況: telnet 禁止の環境で cgi 作りたい場合 (無料ホームページサービス等)(顧客のサーバ環境での開発で、クライアントに信用されていない状況とか) サーバの保守・セキュリティ体制がうんちゃらで make コマンドの利用が規制されている場合 (出くわした経験あり) こんな状況下だと、とたんにDateTimeモジュールを利用する事は難しくなっ
http://d.hatena.ne.jp/kkentaro/20060528/1148838634 Firefox の履歴から YouTube だけ抜く 抜くだけならこんなので。 use File::Mork; my $mork = File::Mork->new( shift ) || die $File::Mork::ERROR; foreach my $entry( grep { $_->{URL} =~ /youtube\.com/ } $mork->entries ) { print $entry->{Name}, "\t", $entry->{URL}, "\n"; }ただこれだけだと、トップページとかログインページとかも引っかかっちゃうけど。 config で、File::Mork::Entry の任意の key から、条件にマッチしたのだけ切り出せるようにして、Custo
Perl のアクセサモジュールとしては、Class::Accessor::Fast が人気すね。 # これは例 package Hoge; use base 'Class::Accessor::Fast'; __PACKAGE__->mk_accessors(qw( req )); sub new { my $class = shift; bless { url => 'http://e8y.net/', req => HTTP::Request->new, }, $class; } こんな風な、ハッシュに bless するよくあるクラスの場合に、そのハッシュのキーと同じ名前でgetterを作成しておくと、属性にアクセスする場合($hoge->url)と属性のオブジェクトのメソッドを呼ぶ場合($hoge->req->header())に、ブレース{} が途中に入ってこないので見やすいし、そ
NAME HTTP::Date - HTTP::Date - date conversion routines VERSION version 6.06 SYNOPSIS use HTTP::Date; $string = time2str($time); # Format as GMT ASCII time $time = str2time($string); # convert ASCII date to machine time DESCRIPTION This module provides functions that deal the date formats used by the HTTP protocol (and then some more). Only the first two functions, time2str() and str2time(), are e
リリース、障害情報などのサービスのお知らせ
最新の人気エントリーの配信
処理を実行中です
j次のブックマーク
k前のブックマーク
lあとで読む
eコメント一覧を開く
oページを開く