2004-08-07(土) 晴のち曇 安静時心拍数 46 [長年日記]
_ CPAN Fiance::NikkeiQuote の patch
動かなかったのでパッチを作ってみました。もともとの動きがよく分かっていないのですが「英文社名」は単純には取得できなくなりました。
--- NikkeiQuote.pm.orig Sun Nov 3 20:06:11 2002 +++ NikkeiQuote.pm Sat Aug 7 08:54:22 2004 @@ -3,15 +3,16 @@ use Carp; use LWP::UserAgent; use HTML::TableExtract; +require 'jcode.pl'; use vars qw($todayUrl $infoUrl $range25Url $VERSION); $todayUrl = - 'http://marketsearch.nikkei.co.jp/stock/result.cfm?scode=*SCODE*'; + 'http://company.nikkei.co.jp/indexs.cfm?scode=*SCODE*'; $infoUrl = - 'http://marketsearch.nikkei.co.jp/cdb/compinfo.cfm?scode=*SCODE*'; + 'http://company.nikkei.co.jp/mprice.cfm?scode=*SCODE*'; $range25Url = - 'http://marketsearch.nikkei.co.jp/cdb/mprice.cfm?scode=*SCODE*'; + 'http://company.nikkei.co.jp/mprice.cfm?scode=*SCODE*'; $VERSION = '0.5.1'; sub new @@ -53,10 +54,10 @@ $url = $todayUrl; $url =~ s/\*SCODE\*/$self->{SCODE}/e; $html = $self->_gethtml($url); - $te = new HTML::TableExtract(depth => 2); + $te = new HTML::TableExtract(depth => 0); $te->parse($html); $ts = ($te->table_states)[1]; - @ret = (@{($ts->rows)[1]})[0,1,2,3,5]; + @ret = (@{($ts->rows)[1]})[1,2,3,4,6]; map{m/([\d,-]+)/; my $tmp = $1; $tmp =~ s/,//g; $_ = $tmp}@ret; return wantarray ? @ret : \@ret; } @@ -67,11 +68,11 @@ my ($url,$html,$te,$ts,@ret); $url = $infoUrl; $url =~ s/\*SCODE\*/$self->{SCODE}/e; - $html = $self->_gethtml($url); + $html = jcode::euc($self->_gethtml($url)); $te = new HTML::TableExtract(depth => 1); $te->parse($html); - $ts = ($te->table_states)[12]; - @ret = (@{($ts->rows)[0]}[1],@{($ts->rows)[1]}[1]); + $ts = ($te->table_states)[0]; + @ret = (@{($ts->rows)[1]})[0]; @ret = map{s/^\s+//; s/\s+$//; $_}@ret; return wantarray ? @ret : \@ret; } @@ -85,7 +86,7 @@ $html = $self->_gethtml($url); $te = new HTML::TableExtract(depth => 1); $te->parse($html); - $ts = ($te->table_states)[20]; + $ts = ($te->table_states)[8]; for (0..25){ $ret[$_] = [map{ s/\s+//g;
サンプルコード
#!/usr/local/bin/perl -w use Finance::NikkeiQuote; # For example, Mitsubishi Motors Corp. my $mmc = Finance::NikkeiQuote->new(7211); print "Name : ",($mmc->getinfo)[0],"\n"; print "Current Price: ",($mmc->gettoday)[3],"\n"; # 25days Range of stock prices; foreach my $row ($mmc->getrange25){ print join(',', @$row)."\n"; }
実行結果
Name : 三菱自動車工業(株) (7211) 東京 Current Price: 80 8/06,76,81,75,80,58353000 8/05,81,83,76,79,117129000 8/04,74,79,72,76,110219000 8/03,88,89,78,79,132848000 8/02,96,96,90,90,53084000 7/30,93,97,90,97,96498000 7/29,98,99,90,92,57098000 7/28,104,105,98,98,41808000 7/27,109,110,99,101,56887000 7/26,111,114,110,110,31771000 7/23,114,117,110,114,86205000 7/22,111,112,108,110,31627000 7/21,111,116,110,111,66123000 7/20,109,113,105,107,81214000 7/16,117,120,103,113,194751000 7/15,160,160,131,137,67500000 7/14,168,173,160,160,46844000 7/13,160,161,158,158,5911000 7/12,165,165,160,161,6876000 7/09,160,165,159,164,7334000 7/08,160,162,156,158,7628000 7/07,160,161,156,157,10219000 7/06,165,165,160,161,11630000 7/05,170,170,167,168,6420000 7/02,170,171,166,169,12712000
_ ja-squirrelmail-1.4.3a_1,1 でログインできず
ログインしようとすると
IMAPサーバーの接続でエラー: tls://localhost 0 : Unknown error: 0
と表示されてしまうようになってしまいました。IlohaMail では問題なくログインできるので IMAP サーバの問題は無さそうです。昨日の portupgrade で何か問題があったのでしょうか。
_ portupgrade devel/porttools graphics/xpdf
porttools-0.50 < needs updating (port has 0.63) xpdf-3.00_2 < needs updating (port has 3.00_3)