diff options
author | kcwu <kcwu@63ad8ddf-47c3-0310-b6dd-a9e9d9715204> | 2005-08-16 22:34:11 +0800 |
---|---|---|
committer | kcwu <kcwu@63ad8ddf-47c3-0310-b6dd-a9e9d9715204> | 2005-08-16 22:34:11 +0800 |
commit | 1598828725cc3a14f4e9a1a18b4212ad808a3516 (patch) | |
tree | 2cb820bce71131ecf10acb43babf9a601cfb22a8 /util/stock.perl | |
parent | 472675788b286d9ce07d478c03b1f526048f682f (diff) | |
download | pttbbs-1598828725cc3a14f4e9a1a18b4212ad808a3516.tar pttbbs-1598828725cc3a14f4e9a1a18b4212ad808a3516.tar.gz pttbbs-1598828725cc3a14f4e9a1a18b4212ad808a3516.tar.bz2 pttbbs-1598828725cc3a14f4e9a1a18b4212ad808a3516.tar.lz pttbbs-1598828725cc3a14f4e9a1a18b4212ad808a3516.tar.xz pttbbs-1598828725cc3a14f4e9a1a18b4212ad808a3516.tar.zst pttbbs-1598828725cc3a14f4e9a1a18b4212ad808a3516.zip |
it's stupid to call c program in perl for string manipulation.
git-svn-id: http://opensvn.csie.org/pttbbs/trunk/pttbbs@3050 63ad8ddf-47c3-0310-b6dd-a9e9d9715204
Diffstat (limited to 'util/stock.perl')
-rw-r--r-- | util/stock.perl | 19 |
1 files changed, 10 insertions, 9 deletions
diff --git a/util/stock.perl b/util/stock.perl index 568c2d86..1c4120ed 100644 --- a/util/stock.perl +++ b/util/stock.perl @@ -6,18 +6,19 @@ # 中央氣象局的 WWW 及 URL 是否正確。 # 理論上適用所有 Eagle BBS 系列。 # -- Beagle Apr 13 1997 -open(BBSPOST, "| bin/webgrep >etc/stock.tmp"); -# 日期 -open(DATE, "date +'%a %b %d %T %Y' |"); -$date = <DATE>; -chop $date; -close DATE; +open(BBSPOST, " >etc/stock.tmp"); # Header # 內容 -#open(WEATHER, "/usr/local/bin/lynx -dump http://www.dashin.com.tw/bulletin_board/today_stock_price.htm |"); while (<WEATHER>) { -open(WEATHER, "/usr/bin/lynx -dump http://quotecenter.jpc.com.tw/today_stock_price.htm |"); while(<WEATHER>) { - print BBSPOST if ($_ ne "\n"); +my $url = 'http://quotecenter.jpc.com.tw/today_stock_price.htm'; +open(WEATHER, "/usr/bin/lynx -dump $url |"); +while(<WEATHER>) { + next if $_ eq "\n"; + last if m/^References/; + + s/\[[0-9\]]*//g; + + print BBSPOST $_; } close WEATHER; |