七行プログラミング (452レス)
七行プログラミング http://medaka.5ch.net/test/read.cgi/php/1036141603/
上
下
前
次
1-
新
通常表示
512バイト分割
レス栞
169: nobodyさん [sage] 03/10/08 01:14 ID:??? 5.005_03 と 5.8.0 の両方でマジメにチェック & 縮め。 #!/usr/local/bin/perl use CGI':all';sub e{my@e;for(0..63){@x=(@{[qw(+ - * /)]}[$_&3,$_>>2&3,$_>>4&3], @n,param n);for$t(qw/(304)1(526) ((304)15)26 30(41(526)) 30((415)26) (30(415))26/){$_=$t;s/(\d)/$x[$1]/g;10-eval or$r?push@e,$_.br:put("$n:$_\n"),$c &&return}}@e}($r=$ENV{REMOTE_ADDR})?put(header,start_html(-title=>7410), startform(0,script_name),p(scrolling_list(-values=>[0..9],name,n,size,1
0)x4, submit),endform,p(e),end_html):do{$$_=1for"@ARGV"=~/\w/g;$n=$_,$h{"@{[sort@n= /./g]}"}++&&$o||$z&&/0/||$d&&4>keys%{{map{$_,1}@n}}or e for'0019'..'9999'} http://medaka.5ch.net/test/read.cgi/php/1036141603/169
170: 7blosxom [] 03/12/01 03:01 ID:i/vnv4B8 #!/usr/bin/perl use CGI':all';use File::Find;$n=param('n')||0;@i=split'/',path_info;shift@i;($y, $m,$d)=grep{/^\d+$/}@i;$p=join'/',grep{/^\D+$/}@i;find sub{($f=$File::Find::name )=~/\.txt$/and$e{$f}=-M},"./$p";put header,start_html;for((sort{$e{$a}<=>$e{$b}} keys%e)[$n..$n+40]){($z,$x,$c)=(localtime(time-60*60*24*$e{$_}))[5,4,3];next if( ($y&&$y!=$z+1900)or($m&&$m!=$x+1)or($d&&$d!=$c)or!-f);s/^\.\///;open(F,$_)&&{ chomp($t=<F>),put(a({-href=>url."/
$_"},h2 $t),<F>,hr,"\n"),close F}}put end_html http://medaka.5ch.net/test/read.cgi/php/1036141603/170
171: 7blosxom [] 03/12/01 03:13 ID:i/vnv4B8 久しぶりに7行プログラミング。 PATH_INFOで指定できるのは、日付とカテゴリのみ。 月の指定は数字のみ可能。Decとかには未対応。 indexや他のFlavourは未実装。 リクエストの例 ./7blosxom.cgi ./7blosxom.cgi/2003 ./7blosxom.cgi/2003/11 ./7blosxom.cgi/2003/11/30 ./7blosxom.cgi/2003/11/foo ./7blosxom.cgi/2003/foo/bar ./7blosxom.cgi/foo/hoge.txt PAGING 機能。意味なくつけてみたけど、いらないよぉな気がする。(TODO remove) ./7blosxom.cgi?n=10 ./7blosxom.cgi?n=10/foo/2000 リクエ
スト例。例外 ./7blosxom.cgi///// ... 何も指定しないのと同じ。 ./7blosxom.cgi/2003/11/30/1/ ... 4つめ以降の数字は無視される。 ./7blosxom.cgi/foo2/ ... 正規表現が手抜きな為、数字+文字の組合せは無視される。 http://medaka.5ch.net/test/read.cgi/php/1036141603/171
172: nobodyさん [] 03/12/01 06:28 ID:i/vnv4B8 訂正。HTML&&桁数間違えてた。 #!/usr/bin/perl use CGI':all';use File::Find;@i=split'/',path_info;shift@i;($y,$m,$d)=grep/^\d+ $/x,@i;$p=join'/',grep{/^\D+$/}@i;find sub{($f=$File::Find::name)=~/\.txt$/and$ e{$f}=-M},"./$p";put header,start_html;for(sort{$e{$a}<=>$e{$b}}keys%e){($z,$x, $c)=(localtime(time-86400*$e{$_}))[5,4,3];if(!(($y&&$y!=$z+1900)or($m&&$m!=$x+1 )or($d&&$d!=$c))&&-f&&open F,$_){s/^\.\///;chomp($t=<F>);put hr,h2 a({href,url. "/$_"},
$t),pre<F>,"\n";close F}}put end_html - データ用のディレクトリをカレントディレクトリ以外に指定したい場合。 ln -s /home/your/data/path home とリンクを作り。 7blosxom.cgi/home とアクセスする。 http://medaka.5ch.net/test/read.cgi/php/1036141603/172
173: 128 [] 03/12/01 18:34 ID:xLzdr2os それじゃ漏れも久々に投稿。 スレッド式掲示板です。 データ用ディレクトリ G が必要です。 ---------------------- 7thread.cgi ----------------------- use CGI":all";charset"x-sjis";*i=*param;*e=*escapeHTML;chdir G;i B,$b,open F,"> $b"if($b=e(i S))&&!-e$b;$b||=i(B);*x=*textfield;open F,"+<$b";[<F>];seekF,0,2;s !http://.+$!a{href,$&},$&!emg,s/\n/br/eg,$n=e(i N)||'七氏',print F dt(++$.,':'. b(a{i(M)&&(href,'mailto:'.e(i M))},$n),':'.localtime),dd($_.p),"\n"if$_=e(
i T); seek F,0,0;put header,start_html($b),h1($b),startform,(i B)?dl(<F>).a{href,'?'} ,'一覧':ol(li[map{a{href,"?B=$_"},$_}sort{-A$a<=>-A$b}<*>]).hr.'スレ'.x(S),hidden (B),br,submit,'名前',x(N),'MAIL',x(M),br,textarea(T,'',6,80,1),endform,end_html ------------------------------------------------------ http://medaka.5ch.net/test/read.cgi/php/1036141603/173
174: nobodyさん [] 03/12/01 20:35 ID:lEOu0k9S モジュールありだったらいくらでも短くできるのでは? http://medaka.5ch.net/test/read.cgi/php/1036141603/174
175: nobodyさん [] 03/12/01 23:22 ID:i/vnv4B8 #!/usr/bin/perl #7blosxom.cgi use CGI':all';use File::Find;($p,$y,$m,$d)=grep/^\D+$/,(@i=split'/',path_info), grep/^\d+$/,@i;find sub{($f=$File::Find::name)=~/\.txt$/and $e{$f}=-M},"./$p"; put header,start_html;for(sort{$e{$a}<=>$e{$b}}keys%e){($c,$x,$z)=(localtime( time-86400*$e{$_}))[3..5];if(!($y&&$y!=$z+1900||$m&&$m!=$x+1||$d&&$d!=$c)&&-f&& open F,$_){s/^\.\///;chomp($t=<F>);put h2 a({href=>url."/$_"},$t),pre<F>,hr; close F}}put end_htm
l __END__ 変更点 < shift@i はいらなかった。 < [5,4,3] をスライスに変更。 < 変数をまとめて宣言。 >174 そうだね。過去ログを読めばわかる通り、それは人によって意見がわかれる所。標準モジュールはokとか。 自分は、モジュールを使っても既存のリソースの有り合わせでおもしろいものが出来ればいいなと思ってる。 wikiもCPANのWiki::関連のモジュールを使えば制限内でも、もっと機能追加出来そうだし。 ただし、短くするためにわざわざモジュールを作る気はなし。 http://medaka.5ch.net/test/read.cgi/php/1036141603/175
176: nobodyさん [sage] 03/12/02 14:16 ID:??? >>175 h2タグの中にpreタグ(と本文)が入るのですが・・・ http://medaka.5ch.net/test/read.cgi/php/1036141603/176
177: nobodyさん [sage] 03/12/02 18:25 ID:??? >>175 Blosxom 知らんかったので和訳サイト読みながらゴニョゴニョ中。 動作確認用の txt ファイルセット用意してくれたら嬉しい。日付と 中身が違うファイルを沢山作るのは結構ダルい。;) http://medaka.5ch.net/test/read.cgi/php/1036141603/177
178: nobodyさん [sage] 03/12/02 22:21 ID:??? >>173 足したり引いたりしてみた。 use CGI":all";*i=*param;*x=*textfield;sub e{escapeHTML i(pop)}chdir G;-e($b=i(B )||e S)or open F,">$b";open F,"+<$b";eval{flock F,2};[<F>];s!http://.+$!a{href, $&},$&!eg,s/\n/br/eg,print F dt($.+1,':',b(a{href,'mailto:'.e M},e(N)||nobody), ':'.localtime),dd($_),"\n"if$_=e T;seek F,0,0;put header,start_html($b), startform,$b?h1($b).dl(<F>).hidden(B,$b).a{href,'?'},list:ol(li[map{a{href, "?B=$_"},$_}sort{-M
$a<=>-M$b}<*>]).thread.x(S),br,submit,NAME,x(N),MAIL,x(M),br ,textarea(T,'',6,80,1),endform,end_html http://medaka.5ch.net/test/read.cgi/php/1036141603/178
179: nobodyさん [sage] 03/12/02 23:32 ID:??? >>177 #!/usr/bin/perl @c=('a'..'z','A'..'F');$t=time;sub j{join'',@c[$_[0]..$_[0]+2]}for(0..23){open( T,'>'.($f=j($_).'.txt'))||die$!;print T j($_),"\n",j($_+3),"\n",j($_+6);utime( $t,$t,$f)||die$!;$t-=25000}opendir(D,'.')||die$!;@f=grep!/^\./,sort readdir D; $t=(stat$f[0])[9]-32000000;for(@f){open(S,$_)||die$!;s/^(\w+)/++$i.uc$1/e;open( D,">$_")||die$!;print D map uc,<S>;utime$t,$t,$_;$t-=50000} http://medaka.5ch.net/test/read.cgi/php/1036141
603/179
180: nobodyさん [sage] 03/12/03 02:02 ID:??? 5.005_03 と 5.8.2 で確認。元より長くなったけど…。 #!/usr/bin/perl use CGI':all';use File::Find;/^\d+$/?$y?$m?($d||=$_):($m=$_-1):($y=$_-1900):/\. txt$/x?($f||=$_):length&&($c.="/$_")for split'/',path_info;find sub{($D,$M,$Y)= (localtime($t=(stat)[9]))[3..5];$e{$File::Find::name}=$t if!($y&&$y-$Y)&&!($m&& $m-$M)&&!($d&&$d-$D)&&(!$f||/^$f$/)&&/\.txt$/},".$c";put header,start_html;for( sort{$e{$b}<=>$e{$a}}keys%e){open F,$_;s|\.||;chomp($h=<F>);put h2
(a{href,url. $_},$h),pre<F>,hr}put end_html ・数字は年・月・日としてこの順に拾われ、4つ目以降は無視 ・数字のみのカテゴリ名は許されないが、含む事は可 ・カテゴリは出現順に階層化されているものとして処理する ・".txt" が末尾に付くものはファイルとし、最初に現れたもののみ有効 例 ./7blosxom.cgi ./7blosxom.cgi/2003 ./7blosxom.cgi/2003/11 ./7blosxom.cgi/2003/11/30 ./7blosxom.cgi/foo ./7blosxom.cgi/hoge.txt ./7blosxom.cgi/foo/hoge.txt ./7blosxom.cgi/2003/foo/bar ./7blosxom.cgi/2003/foo/11/bar/30/fuga.txt ./7bl
osxom.cgi/fuga.txt/2003/////foo1/11////bar2/30 http://medaka.5ch.net/test/read.cgi/php/1036141603/180
181: nobodyさん [sage] 03/12/03 02:13 ID:??? >>180 1月ダメじゃん…。 :($m=$_-1): => :($m=$_): !($m&&$m-$M) => !($m&&$m-$M-1) http://medaka.5ch.net/test/read.cgi/php/1036141603/181
182: nobodyさん [] 03/12/03 06:43 ID:4m1BwtbU >175 $p の指定に不具合あり。join忘れてた。 use CGI':all';use File::Find;$P=join'/',grep/^\D\w*$/,(@i=split'/',path_info);( $Y,$M,$D)=grep/^\d+$/,@i;find sub{($d,$m,$y)=(localtime($t=(stat)[9]))[3..5];!( !($Y&&$Y-$y-1900)&&!($M&&$M-$m-1)&&!($D&&$D-$d)&&/\.txt/&&(!$i[-1]||/^$i[-1]$/) )or$e{$File::Find::name}=$t},"./$P";put header,start_html;for(sort{$e{$b}<=>$e{ $a}}keys%e){open F,$_;s/^\.//;chomp($h=<F>);put h2(a{href,url.$_},$h),pre<F>,hr
;close F}put end_html; 若干仕様変更。 - カテゴリ名は /^\D\w*$/ - ファイルの指定は、PATH_INFO の末尾のみ有効。 - findの対象はカレントディレクトリ以下のみ。(絶対パス指定できるのは、流石にちょっと BTW,ファイルハンドルってスコープ抜けたら勝手にcloseされるんだっけ?perlって。 http://medaka.5ch.net/test/read.cgi/php/1036141603/182
183: nobodyさん [sage] 03/12/03 07:46 ID:??? >182 テスト不十分だった。訂正 > $i[-1]!~/\.txt$/||/^$i[-1]$/ http://medaka.5ch.net/test/read.cgi/php/1036141603/183
184: 7thread [sage] 03/12/03 09:43 ID:??? use CGI":all";*i=*param;*x=*textfield;sub e{escapeHTML i pop}sub l{a{href,pop}, pop}chdir G;-e($b=i(B)||e S)||open F,">$b";open F,"+<$b";eval{flock F,2};[<F>]; s!\w+://.+$!l$&,$&!eg,s/\n/br/eg,print F dt($.+1,':'.b(l e(N)||nobody,'mailto:' .e M),':'.localtime),dd($_),"\n"if$_=e T;seek F,0,0;put header,start_html($b), startform,$b?h1($b).dl(<F>).hidden(B,$b).l list,'?':ol(li[map{l$_,"?B=$_"}sort{ -M$a<=>-M$b}<*>]).thread.x(S),br,submit,
NAME,x(N),MAIL,x(M),br,textarea(T,'',6, 80,1),endform,end_html http://medaka.5ch.net/test/read.cgi/php/1036141603/184
185: nobodyさん [sage] 03/12/03 20:55 ID:??? 7thread.cgi l10n for Japanese :) #!/usr/local/bin/perl use CGI":all";*i=*param;*x=*textfield;sub e{escapeHTML i pop}sub l{a{href,pop}, pop}chdir G;-e($b=i(B)||e S)||open F,">$b";open F,"+<$b";eval{flock F,2};[<F>]; s!\w+://.+$!l$&,$&!eg,s/\n/br/eg,print F dt($.+1,':'.b(l e(N)||'ナナシ','mailto:'. e M),':'.localtime),dd($_),"\n"if$_=e T;seek F,0,0;put header(-charset=>$c= Shift_JIS),start_html(-title=>$b||$0,encoding,$c,lang,ja),startform,$b?h1($b
). dl(<F>).hidden(B,$b).l 'スレ','?':ol(li[map{l$_,"?B=$_"}sort{-M$a<=>-M$b}<*>]).'ス レ'.x(S),br,submit,Name,x(N),Mail,x(M),br,textarea(T,'',6,80,1),endform,end_html >>182 検証方法が思いつかず…。>スコープ抜けで close http://medaka.5ch.net/test/read.cgi/php/1036141603/185
186: nobodyさん [sage] 03/12/03 23:13 ID:??? 7blosxom.cgi l10n for Japanese start_html に -title=>$0 入れると7行に収まらなかった(苦)。 #!/usr/bin/perl use CGI':all';use File::Find;($Y,$M,$D)=grep/^\d+$/,@i=path_info=~m|/([^/]+)|g; $R=$i[-1]=~/\.txt$/?pop@i:'\.txt';find sub{($d,$m,$y)=(localtime($t=(stat)[9])) [3..5];$e{$File::Find::name}=$t if!($Y&&$Y-$y-1900)&!($M&&$M-$m-1)&!($D&&$D-$d) &/$R$/},$P=join('/','.',grep!/\.\.|^\d+$/,@i);put header(-charset=>$c='EUC-JP') ,start_html(-encoding=>$c,lang
,ja);for(sort{$e{$b}<=>$e{$a}}keys%e){open F,$_; s/^\.//;chomp($h=<F>);put h2(a{href,url.$_},$h),pre<F>,hr}put end_html >>182 '..' さえ防いだら大丈夫な気も… 既に開かれてるファイルハンドルを open し直すと、開いていたファイルは close されてから新しいファイルを open するので、close は明示しなくても 可な筈。 http://perldoc.com/perl5.8.0/pod/func/close.html http://medaka.5ch.net/test/read.cgi/php/1036141603/186
187: nobodyさん [sage] 03/12/03 23:57 ID:??? >>186 ちと修正。 #!/usr/bin/perl use CGI':all';use File::Find;($Y,$M,$D)=grep/^\d+$/,@i=path_info=~m|/([^/]+)|g; $R=$i[-1]=~/\.txt$/?pop@i:'.txt';find sub{($d,$m,$y)=(localtime($t=(stat)[9]))[ 3..5];$e{$File::Find::name}=$t if!($Y&&$Y-$y-1900)&!($M&&$M-$m-1)&!($D&&$D-$d)& /\Q$R\E$/},join'/','.',grep!/\.\.|^\d+$/,@i;put header(-charset=>$c='EUC-JP'), start_html(-encoding=>$c,lang,ja);for(sort{$e{$b}<=>$e{$a}}keys%e){open F,$_; s/^\.//;chomp($h=
<F>);put h2(a{href,url.$_},$h),pre<F>,hr}put end_html http://medaka.5ch.net/test/read.cgi/php/1036141603/187
188: nobodyさん [sage] 03/12/04 01:07 ID:??? なにこのすれ(;´Д`) http://medaka.5ch.net/test/read.cgi/php/1036141603/188
189: 128 [] 03/12/04 03:24 ID:h3ZU5uFM 皆、お疲れ〜。 元気っぽいですな。 >>185 7thread 修正どうもです。かなりいけてました。 charset()を使わないと、escapeHTMLで文字化けが起こりますね。(「機能」とか) EUCにしようかとも思ったんだけど。 #!/usr/local/bin/perl use CGI":all";charset$c=Shift_JIS;*i=*param;*x=*textfield;sub l{a{href,pop},pop }sub e{escapeHTML i pop}chdir G;$b=e(B)||e S;open F,"+>>$b";flock F,2;[<F>];$t= 'スレッド';s!\w+://.+$!l$&,$&!emg,s/\n/br/eg,print F dt($.+1,':'.b(l e(N
)||'七氏', 'mailto:'.e M),':'.gmtime),dd($_),"\n"if$_=e T;seek F,0,0;put header,start_html (-title=>$b||$t,encoding,$c,lang,ja,style,[<DATA>]),startform,h1($b||$t),$b?dl( <F>).hidden(B,$b).l $t,'?':ol(li[map{l$_,"?B=$_"}sort{-M$a<=>-M$b}<*>]).$t.x(S) ,br,submit,Name,x(N),Mail,x(M),br,textarea(T,'',7,80,1),endform,end_html http://medaka.5ch.net/test/read.cgi/php/1036141603/189
190: 128 [] 03/12/04 03:32 ID:h3ZU5uFM オオボケでした。 開発中のを送ってしまった。 こっちです。 use CGI":all";charset$c=Shift_JIS;*i=*param;*x=*textfield;sub l{a{href,pop},pop }sub e{escapeHTML i pop}chdir G;$b=e(B)||e S;open F,"+>>$b";flock F,2;[<F>];$t= 'スレッド';s!\w+://.+$!l$&,$&!emg,s/\n/br/eg,print F dt($.+1,':'.b(l e(N)||'七氏', 'mailto:'.e M),':'.gmtime),dd($_),"\n"if$_=e T;seek F,0,0;put header,start_html (-title=>$b||$t,encoding,$c,lang,ja),startform,h1($b||$t),$b?dl(<F>).hid
den(B, $b).l $t,'?':ol(li[map{l$_,"?B=$_"}sort{-M$a<=>-M$b}<*>]).$t.x(S),br,submit, Name,x(N),Mail,x(M),br,textarea(T,'',7,80,1),endform,end_html http://medaka.5ch.net/test/read.cgi/php/1036141603/190
191: nobodyさん [sage] 03/12/04 06:04 ID:??? >>189 > charset()を使わないと、escapeHTMLで文字化け あぁ、確かに ad hoc な事やってますな…。相変わらず CGI.pm はダサい。:< #!/usr/bin/perl use CGI":all";charset$c=Shift_JIS;*i=*param;*x=*textfield;sub l{a{href,pop},pop }sub e{escapeHTML i pop}sub r{seek F,0,0}chdir G;($b=e(B)||e S)=~m![./]!&¨ open F,"+>>$b";flock F,2;r;[<F>];s!\w+://.+!l$&,$&!eg,s/\n/br/eg,print F dt($.+ 1,':'.b(l e(N)||'七氏','mailto:'.e M),':'.localtime),dd($_),"\n
"if$_=e T;r;$t= 'スレ';put header,start_html(-title=>$b||$t,encoding,$c,lang,ja),startform,$b?h1( $b).dl(<F>).hidden(B,$b).l $t,'?':ol(li[map{l$_,"?B=$_"}sort{-M$a<=>-M$b}<*>]). $t.x(S),br,submit,Name,x(N),Mail,x(M),br,textarea(T,'',7,80,1),endform,end_html ・レス番号が増えないのを fix 。 ・スレタイに [./] は使用不可 (「../7thread.cgi」なんてスレ立てられると…) 。 ・gmtime は流石にどうかと思う。 ・上記改造のしわ寄せを h1 周りに。 http://medaka.5ch.net/test/read.cgi/php/1036141603/191
192: nobodyさん [] 03/12/04 21:36 ID:b7RTKokI 7thread 差分 < *i=*param < sub e{escape i pop} > sub e{escape param pop} > -title=>$b=($t='スレ') >186 thx URL なるほど、close省略出来たんだ。 FileHandle にはスコープは関係なかったね。IO::Fileと勘違いしてた。 blosxom ... 残り1行じゃFlavourは無理かなぁ http://medaka.5ch.net/test/read.cgi/php/1036141603/192
193: 128 [] 03/12/05 03:38 ID:2kvaGCEL 乙カレーっす。 7thread ログの形式を変えてみました。 今までのログは利用できません。 あと__DATA__以降にスタイルシートを指定できるようにしました。 #!/usr/bin/perl use CGI":all";charset$c=Shift_JIS;*i=*param;*x=*textfield;sub l{a{href,pop},pop }sub e($){escapeHTML i pop}chdir G;($F=e B||e S)=~m![./]!?die:open F,">>$F";$t= 'スレ';$d=e N||'七氏';flock F,2;s!\w+://.+!l$&,$&!eg,s/\n/br/eg,print F li(b(e M? l$d,'mailto:'.e M:$d),localtime.p$_)if$_=e T;open F;$/='';put head
er,start_html (-title=>$F||$t,-style=><DATA>,encoding,$c,lang,ja),startform,h1($F||$t),$F?ol( <F>).hidden(B,$F).l $t,'?':ol(li[map{l$_,"?B=$_"}sort{-M$a<=>-M$b}<*>]).$t.x(S) ,br,submit,Name,x(N),Mail,x(M),br,textarea(T,'',7,80,1),endform,end_html __DATA__ h1{color:red; font-size:140%;} p {margin:0; padding:0.5em; background:#EEF;} http://medaka.5ch.net/test/read.cgi/php/1036141603/193
194: nobodyさん [] 03/12/05 06:41 ID:1VQJofzV sage機能実装。大幅に機能削ってしまったのでbranch. marge よろしく;-] use CGI":all";charset$c='EUC-JP';sub l{a{href,pop},pop}chdir G;sub e{escapeHTML param pop}$d=e(N)||'七氏';($F=e B)=~/[.\/]/?die:($u=($m=e M)=~/sage/?(stat($F)) [9]:0),open F,">>$F";flock F,2;s!\w+://.+!l$&,$&!eg,s/\n/br/eg,print F li(b($m? l$d,'mailto:'.$m:$d),localtime.p$_)if$_=e T;$t='スレ';open F;$/='';*x=*textfield; put header,start_html($F||$t),startform,h1($F||$t),$F?ol(<F>).h
idden(B,$F).l$t, '?':ol(li[map{l$_,"?B=$_"}sort{-M$a<=>-M$b}<*>]).$t.x(B),br,submit,Name,x(N), Mail,x(M),br,textarea(T,'',7,80,1),endform,end_html;$u&&utime time,$u,$F http://medaka.5ch.net/test/read.cgi/php/1036141603/194
195: nobodyさん [sage] 03/12/05 06:41 ID:??? >>193 一引数の open で開き直すのはナイスですな。 start_html に -style を指定すると、外部 CSS への link 要素を吐く (少なくとも CGI.pm 3.00 では) 。ので、style 要素に変更。 #!/usr/bin/perl use CGI":all";sub l{a{href,pop},pop}sub e($){escapeHTML param pop}($C,$B,$S,$D) =<DATA>;charset$C;chdir G;($F=e B||e S)=~m![./]!?die:open F,">>$F";flock F,2;s! \w+://.+!l$&,$&!egx,s/\n/br/eg,print F li(b(e M?l e N||$D,'mailto:'.e M:e N||$D ),localtime.p$_)if$
_=e T;*x=*textfield;open F;put header,start_html(-title=>$F ||$B,encoding,$C,lang,ja),style($S),startform,h1($F||$B),$F?ol(<F>).hidden(B,$F ).l Threads,'?':ol(li[map{l$_,"?B=$_"}sort{-M$a<=>-M$b}<*>]).NewThread.x(S),br, submit,Name,x(N),Mail,x(M),br,textarea(T,'',7,80,1),endform,end_html __DATA__ Shift_JIS 7ch h1{color:red; font-size:140%;} p {margin:0; padding:0.5em; background:#EEF;} 七氏 http://medaka.5ch.net/test/read.cgi/php/1036141603/195
196: 195 [sage] 03/12/05 06:42 ID:??? >>194 むぅ。(w http://medaka.5ch.net/test/read.cgi/php/1036141603/196
197: nobodyさん [sage] 03/12/05 07:03 ID:??? >193 お疲れ様。取り急ぎ、動作報告します。 Perl5.8.2/CGI.pm3.00, Perl5.6.1/CGI.pm2.752で確認しました。 -style=<DATA> は、CGIpm/3.00ではlinkのhref属性に入ってしまう。 引数の型によってlink, styleの出力を区別してるらしい。see _style method in CGI.pm 古いバージョンのCGI.pmではxmlのencoding属性の指定は出来ない。 <body encoding="..." となるので特に影響はないけど。 http://medaka.5ch.net/test/read.cgi/php/1036141603/197
198: nobodyさん [sage] 03/12/05 13:00 ID:??? >>194 *本当に下がる* sage 機能、無理矢理 merge 。:p URL auto link が犠牲に。 #!/usr/bin/perl use CGI":all";sub l{a{href,pop},pop}sub e($){escapeHTML param pop}($C,$B,$D,@S) =<DATA>;charset$C;chdir G;($F=e B||e S)=~m![./]!?die:open F,">>$F";flock F,2;$s =($m=e M)=~/sage/;*x=*textfield;s/\n/br/eg,print F li(b($m?l e N||$D,'mailto:'. $m:e N||$D),localtime.p$_)if$_=e T;close F;$s&&utime 1,1,$F;open F;put header, start_html(-title=>$F||$B,encodi
ng,$C,lang,ja),style(@S),startform,h1($F||$B), $F?ol(<F>).hidden(B,$F).l Top,'?':ol(li[map{l$_,"?B=$_"}sort{-M$a<=>-M$b}<*>]). New.x(S),br,submit,Name,x(N),Mail,x(M),textarea(T,'',7,80,1),endform,end_html __DATA__ Shift_JIS 7ch 七氏 h1 {color:red; font-size:140%;} p {margin:0em; padding:0.5em; background:#EEF;} utime は FreeBSD だとファイル閉じないと効かなかったです。 Win98SE だと開いたままいぢれたけど。 http://medaka.5ch.net/test/read.cgi/php/1036141603/198
メモ帳
(0/65535文字)
上
下
前
次
1-
新
書
関
写
板
覧
索
設
栞
歴
あと 254 レスあります
スレ情報
赤レス抽出
画像レス抽出
歴の未読スレ
Google検索
Wikipedia
ぬこの手
ぬこTOP
0.011s