Free CGI Rewrites

公開されてい(る|た) CGI Script から工夫や試行錯誤の跡が感じらる、面白味のある、 興味深い物 丈けを Pickup しています。

Perl は柔軟な記述が出来る言語です。同じ結果を求めるのにも十人十色。様々な書き方を読む亊によって、違った発想が出てくるかもしれません。

どうしてこういう書き方になるのだろう、何故この手順が必要なのだろう… 等々、色々分からないことがあります。

で、日々そんな Script を探してきては「ほぅ」とか「へぇ」とか云ったり書き換えたり して楽しんでいます。つまり、私が Perl 初心者で ( 勉強中 | 練習中 ) ということですね。

方針

兎に角短くしたい
Script は短い程読みやすいと思ってゐます。
一時変数は Default Name に
使い捨てなのに一々名前を付けるのは無駄だと思ってゐます。
文法は正しく
Perl, HTML, ECMA Script, HTTP Header は行儀よく。
効率は考えない
Server の負荷、Speedup 等は全然考慮してゐません。

Simple BBS を作ってみよう

Programming Perl から Chapter 6.4.1.1 を一寸丈け引用しときます。

1 行に 1 個ずつ、無数の print 文が散りばめられている CGI スクリプトをよく見かける。 これは F-16 を操縦して、教会に行くのに少し似ている。 無事に辿りつけたらの話だが……。

Sample CGI Script の説明をします。CGI 書く場合は必ずセキュリティに気を遣いましょう。

use integer;

実数演算を使わない場合は宣言すると何かと面倒がなくて楽チン。

if ($ENV{REQUEST_METHOD} eq 'POST' && $ENV{CONTENT_LENGTH} < 1e4)
{
    use Jcode;

Get では受け付けなくしてゐて要らない處理なので Post の時だけ use する。

    eval { flock _, 2 };

排他處理した方がいいので flock するが、環境に因っては動作しないので eval しておく。でも、不必要なら書かなくて良い。

引數は block の方が効率的 (see perldoc -f eval)。

        splice @_, 100;

配列が設定数を超えた場合は削除します。此処では戻り値を捨ててゐますが backup してもよいでせう。

        eval { truncate _, tell };

書き込んでから其の位置で eof にすれば、より安全。

$, = $\ = "\x0D\x0A";

"\r""\n"環境に依存する ので、8, 16 進法で書く等して、より安全に。ここでは $, ($LIST_SEPARATOR), $\ ($OUTPUT_RECORD_SEPARATOR); に設定して、出力を簡略化してゐます。

    'Content-Type: text/html; charset=UTF-8',

HTML の <head> ではなく其れより前の HTTP Header の出力時に charset を指定してしまえば文字化けは起りません。 User-Agent は HTML Document が送られて来る前に既に Character-Set を知ってゐるからです。

<form method="post" action="?"
    accept-charset="UTF-8,Shift_JIS,EUC-JP,ISO-2022-JP">

$ENV{SCRIPT_NAME}, $ENV{SCRIPT_URL} を使う場合、 /cgi-bin/bbs.cgi みたいな path が返って来るとは限りません。URI とは関係ない /h/a/n/hanaden/cgi-bin/bbs.cgi みたいな local path だったり /cgi-bin/cgiwrapkiller/hanaden/bbs.cgi なんてのも。 $ENV{SCRIPT_URI} だと増しだけど Server に因っては空文字列が返るかも。 $ENV{HTTP_HOST} . $ENV{REQUEST_URI} だったら正解かな?

File name 丈け使うんだったら %ENV じゃなくでも qx/basename $0/ でも一緒 (system 関数が使えない server だと無理か……)。或いは my ($script_name) = (split '[\\:/]', $0)[-1]; とか。結局、環境変数から File name を得られるかどうか調べるより Browser が Access した URI に Post する様にした方が簡単。

あんまり説明する事も無けりゃ、Subroutine も無い。

参考: web と CGI のひみつ

書き換えてみよう

参考: Programming Perl, Chapter 6.3; 特に 6.3.1.1 は重要。少し引用しておきます。

ふつうは,あなたはどの変数が汚染されたデータを持っているかを知っている筈だ。 ――だから、そのデータの汚染を取り除けば良い。 汚染チェックのメカニズムをバイパスする唯一の方法は、 正規表現マッチによってセットされたサブパターンの値を参照することである。 その根拠は、$1, $2, ……を使って部分文字列を参照するなら、あなたはパターンを書く時に、 自分が何をしているか理解していて、危険なものすべてを取り除くパターンを書くだろうということだ。 だから、少々頭を使わなければならない―― むやみに何でもかんでも汚染を取り除いてはならない。 さもないと、汚染チェック機能全体を無意味にしてしまうことになる。 また、変数が悪い文字を含んでいるかをチェックするのではなく、むしろ変数が正しい文字だけを含んでいることを確認すること。 なぜなら、考えもしなかった悪い文字を見逃してしまうというのは、よくあることだからだ。

致命的エラー

if (!open(DATA,"$infile")) {    return ;    }
if ( !(open(OUT,">$outfile")))  {   return; }

package main に return が書いてありますので、致命的 error です。

perl -w conv.pl
Can't return outside a subroutine at conv.pl line 19.

use strict; use warnings; use Diagnostics; 等を付ければ直ぐ気付いた筈なので、使ってないのがバレバレ。

致命的ノーエラー

eval {$passwd = crypt("sample","test");};
if ($@) { &error(1,'致命的エラー:このプロバイダには TalkMate は設置できません!'); }

設置したら用無しなのに、プロセス毎に通る箇所に書いてあるんですけど……。

しかも、一頻り Query の Decode とか終わって、 File の Lock まで済ませてる箇所に……。

なにがなんでも組み込み関数を使わない

sub decode_text
{
    # デコード
    local ($text) = $_[0];
    $text =~ s/&#40/\(/g;
    $text =~ s/&#41/\)/g;
    $text =~ s/&#42/\*/g;
    $text =~ s/&#43/\+/g;
    $text =~ s/&#46/\./g;
    $text =~ s/&#63/\?/g;
    $text =~ s/&#91/\[/g;
    $text =~ s/&#92/\\/g;
    $text =~ s/&#93/\]/g;
    $text =~ s/&#123/\{/g;
    $text =~ s/&#124/\|/g;
    $text =~ s/&#125/\}/g;
    return $text;
}

なんでじゃぁ〜!! 而も殆ど書き戻ししてるのに一時変数要らんぞ。

sub decode_text
{
    $_[0] =~ s/&#(\d+);?/chr $1/eg;
}

なにがなんでも Browser の理解しない文字コードにしたい

;#  ○ (オプション) 日本語文字コードの変換
;#      このCGIは日本語文字コードの変換機能を自前で実装しているので,
;#      日本語文字コード変換ライブラリを必要としません.
;#      しかし,日本語文字コードの変換に jcode.pl ライブラリを用いることが可能です.
;#      もし,jcode.pl がある場合は,そちらを優先して利用し,半角カナを全角カナ
;#      へ変換する機能が追加されます.
;#      どうしても利用したい場合は,以下のパスを jcode.pl のある場所に書き換えてください.
;#      (もしくは,jcode.pl をこのCGI本体と同じディレクトリ(フォルダ)に置いてください)
$::jcode_liblary = 'jcode.pl';
sub check_code
{
    my $jcode = shift;      # (引数) jcode.pl へのパス(省略時は使用しない)
    my $check_code = shift; # (引数) 文字コードセット
    $Sys{'jcode'} = -r $jcode ? 'jcode.pl' : 'no_jcode';
    require $jcode if ($Sys{'jcode'} ne 'no_jcode' && -r $Sys{'jcode'});
#   eval $GA_JCODE if ($Sys{'jcode'} eq 'no_jcode');
    # ※注意 ここを書き換えると文字化けするかもしれません
    $check_code ||= ord(substr("じゃわ",0,1));
    $check_code = 'sjis' if ($check_code == 0x82);
    $check_code = 'euc'  if ($check_code == 0xA4);
    $check_code = 'jis'  if ($check_code == 0x1B);
    if ($check_code eq 'sjis')
        { $Sys{'CharCode'} = "sjis"; $Sys{'CharSet'} = "Shift-JIS"; }
    elsif ($check_code eq 'euc')
        { $Sys{'CharCode'} = "euc"; $Sys{'CharSet'} = "x-euc-jp"; }
    elsif ($check_code eq 'jis')
        { $Sys{'CharCode'} = "jis"; $Sys{'CharSet'} = "iso-2022-jp"; }
    else
        {
            # Shift-JISとしてエラー「サポートされていない文字コードです」を返す
            $Sys{'CharCode'} = "sjis"; $Sys{'CharSet'} = "Shift-JIS";
            &error("\x83T\x83|\x81[\x83g\x82ウ\x82\xEA\x82ト\x82「\x82ネ" .
                          "\x82「\x95カ\x8E\x9A\x83R\x81[\x83h\x82ナ\x82キ");
        }
}

初期設定で決めた jcode.pl の path を -r で調べてゐるのに、其れを使わず新たに設定し直した文字列に対して 2 回目の -r test をするのは何故か? (要するに設定させておいて其れを使わせない)。

文字列を中途半端に escape したら扱いにくいし面倒臭い。無駄な手間が増える。

sub check_code
{
    my ($jcode) = @_;
    -r $jcode and require $jcode;
    @Sys{CharCode,CharSet} = @{{(
        0x1B => [qw/ jis  ISO-2022-JP /],
        0x82 => [qw/ sjis Shift_JIS /],
        0xA4 => [qw/ euc  EUC-JP /],
    )}->{ord substr 'じゃわ', 0, 1}}
        or error('サポートされていない文字コードです');
}

一杯分けて書くのもいけど、もっと短くて済む。というか抑々 Shift-JIS なんて指定しても Browser は理解しないし、Netscape Navigator が無限 Loop した事とか知らんのでしょうな。 $check_code は上書きする上に使い捨てなので要らない。

参考: Shift_JIS - Wikipedia

なにがなんでも 1 byte づつしか print しない

#--------------#
#  エラー処理  #
#--------------#
sub error {
    if ($lockflag) { &unlock; }
    @err = ('47','49','46','38','39','61','2d','00','0f','00','80','00','00','00','00','00','ff','ff','ff','2c', '00','00','00','00','2d','00','0f','00','00','02','49','8c','8f','a9','cb','ed','0f','a3','9c','34', '81','7b','03','ce','7a','23','7c','6c','00','c4','19','5c','76','8e','dd','ca','96','8c','9b','b6', '63','89','aa','ee','22','ca','3a','3d','db','6a','03','f3','74','40','ac','55','ee','11','dc','f9', '42','bd','22','f0','a7','34','2d','63','4e','9c','87','c7','93','fe','b2','95','ae','f7','0b','0e', '8b','c7','de','02','00','3b');
    print "Content-type: image/gif\n\n";
    foreach (@err) {
        $data = pack('C*',hex($_));
        print $data;
    }
    exit;
}

この Error 処理が表示するのは ERROR と書いてある丈けの画像です。 なんてお莫迦さんなんでせう。 どうやら、次の Script を真似た様ですが。

毎度思うんですが、不必要な使ひ捨ての代入が多いと讀みづらいと思います。 というか、なんで 1 byte 單位で print するの?

sub copyright
{
    print 'Content-type: image/gif', "\x0D\x0A" x 2,
        map pack('H2', $_), qw{
            47 49 46 38 39 61 2d 00 1d 00 b3 00 00 00 00 00
            40 00 00 ff ff ff ff ff ff ff ff ff ff ff ff ff
            ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
            ff ff ff ff ff ff ff ff ff ff ff ff ff 21 f9 04
            01 00 00 00 00 2c 00 00 00 00 2d 00 1d 00 40 04
            d2 10 c8 49 ab bd 38 67 21 42 f7 5c 20 82 21 57
            76 66 b9 a5 6c 9b 4a ae 56 7d 02 10 82 62 7d ab
            36 49 e7 32 d8 6b e2 32 69 86 18 d4 0d 07 a4 f5
            48 50 cf 31 b7 ab d2 96 46 58 0e 18 ec 7a bf e0
            b0 17 6b fb f8 b8 49 74 7a c7 d4 5d 95 6f f5 6c
            84 5b 6e 47 66 0f 9d 5e 5b 51 e3 51 26 50 1c 4f
            7b 7d 44 78 55 89 4e 82 78 4f 57 73 7b 51 86 8d
            7c 76 8e 62 99 9a 9b 9c 5a 54 42 96 72 91 87 1b
            7c 3d 4e 65 84 2d 44 59 a5 8a 80 4c 94 98 7e 58
            3b 65 81 8f 27 2b 70 7f 7f 80 56 a2 14 45 c3 c4
            45 53 92 b1 86 b7 a6 c3 16 66 8d b5 57 be 7d 3f
            24 33 79 be 92 aa 94 cb a8 a3 3a 54 9f 6f 29 4d
            77 a4 42 bf c0 6d 82 d0 9f d7 31 cd a9 2c f2 f3
            12 11 00 00 3b
       };
    exit 0;
}

と云うよりも、最近の Browser では、此の處理自體が要らないです。

<img alt="&copy;" width="45" height="29" src="data:image/gif;base64,
R0lGODlhLQAdAPECAEAAAP///wAAAAAAACH5BAUAAAIALAAAAAAtAB0AAALLlI+py+0Po5y0
2htyRrpr10EBQG5CRpYjEICluLJn3L3N2j6xPOJG6MnNTLeealdL9pIiFs7opO1SKJurunxh
UZqjlcGV+sJjLxEcpdJOWjMWRPZGn0+5cIHMplh75L4PFyQ4SPhRVDj4E0QxpfZHNfPXQqiw
RWcXt9EokyCmolY3l4NzVIl5mVb6U/J1UNXXJTkpG8nH2Qn6aTcESOqEp8LmFExXw8N6i8sT
Olk3Ood8p4gaW12c+mT6GCv7mrtdmUg55EFefoHOUAAAOw==" />

の様に Data Scheme で HTML に埋め込んでしまえば事足りるので。

なにがなんでも Array にしたい

Hash を使った方が簡単。

%_ = qw{
    #0000FF     青
    #DF0000     赤
    #008040     みどり
    #800000     茶
    #C100C1     紫
    #FF80C0     ピンク
    #FF8040     オレンジ
    #000080     あい色
};

Array が必要なら keysvalues で取り出せるし、順不同なら while ($colors, $iroiro) = each %_ だけで済んだりするし。

#<<<地域テーブル ※$colorflg=0の場合、下記で指定したカラーコードで地域が表示されます。$colorflg=1の場合は修正不要です
$AREATBL[0] = '北海道';   $COLORTBL[0] = "#993300";
$AREATBL[1] = '青森';   $COLORTBL[1] = "#336600";
$AREATBL[2] = '秋田';   $COLORTBL[2] = "#CCFF00";
$AREATBL[3] = '岩手';   $COLORTBL[3] = "#66CC00";
$AREATBL[4] = '山形';   $COLORTBL[4] = "#33CC00";
$AREATBL[5] = '宮城';   $COLORTBL[5] = "#336600";
$AREATBL[6] = '新潟';   $COLORTBL[6] = "#996600";
$AREATBL[7] = '福島';   $COLORTBL[7] = "#660033";
$AREATBL[8] = '石川';   $COLORTBL[8] = "#006600";
$AREATBL[9] = '富山';   $COLORTBL[9] = "#999999";
$AREATBL[10] = '群馬';   $COLORTBL[10] = "#333300";
$AREATBL[11] = '栃木';   $COLORTBL[11] = "#990000";
$AREATBL[12] = '茨城';   $COLORTBL[12] = "#330033";
$AREATBL[13] = '福井';   $COLORTBL[13] = "#990033";
$AREATBL[14] = '長野';   $COLORTBL[14] = "#CC6600";
$AREATBL[15] = '埼玉';   $COLORTBL[15] = "#660066";
$AREATBL[16] = '東京';   $COLORTBL[16] = "#006666";
$AREATBL[17] = '千葉';   $COLORTBL[17] = "#000033";
$AREATBL[18] = '島根';   $COLORTBL[18] = "#003333";
$AREATBL[19] = '鳥取';   $COLORTBL[19] = "#669900";
$AREATBL[20] = '兵庫';   $COLORTBL[20] = "#330066";
$AREATBL[21] = '大阪';   $COLORTBL[21] = "#999900";
$AREATBL[22] = '京都';   $COLORTBL[22] = "#990000";
$AREATBL[23] = '滋賀';   $COLORTBL[23] = "#009999";
$AREATBL[24] = '岐阜';   $COLORTBL[24] = "#999933";
$AREATBL[25] = '山梨';   $COLORTBL[25] = "#CC6699";
$AREATBL[26] = '神奈川';   $COLORTBL[26] = "#006699";
$AREATBL[27] = '佐賀';   $COLORTBL[27] = "#663300";
$AREATBL[28] = '福岡';   $COLORTBL[28] = "#336600";
$AREATBL[29] = '山口';   $COLORTBL[29] = "#CC3300";
$AREATBL[30] = '広島';   $COLORTBL[30] = "#993366";
$AREATBL[31] = '岡山';   $COLORTBL[31] = "#333333";
$AREATBL[32] = '和歌山';   $COLORTBL[32] = "#FFCC66";
$AREATBL[33] = '奈良';   $COLORTBL[33] = "#330000";
$AREATBL[34] = '三重';   $COLORTBL[34] = "#CC6633";
$AREATBL[35] = '愛知';   $COLORTBL[35] = "#FF9900";
$AREATBL[36] = '静岡';   $COLORTBL[36] = "#666633";
$AREATBL[37] = '長崎';   $COLORTBL[37] = "#660033";
$AREATBL[38] = '熊本';   $COLORTBL[38] = "#996600";
$AREATBL[39] = '大分';   $COLORTBL[39] = "#003366";
$AREATBL[40] = '鹿児島';   $COLORTBL[40] = "#666666";
$AREATBL[41] = '宮崎';   $COLORTBL[41] = "#CCCC00";
$AREATBL[42] = '愛媛';   $COLORTBL[42] = "#CC9966";
$AREATBL[43] = '香川';   $COLORTBL[43] = "#CC0000";
$AREATBL[44] = '高知';   $COLORTBL[44] = "#FFFF33";
$AREATBL[45] = '徳島';   $COLORTBL[45] = "#FF6666";
$AREATBL[46] = '沖縄';   $COLORTBL[46] = "#006666";
$AREATBL[47] = 'ヨーロッパ(Europe)';   $COLORTBL[47] = "#ffffcc";
$AREATBL[48] = 'アフリカ(Africa)';   $COLORTBL[48] = "#ffffcc";
$AREATBL[49] = 'アジア(Asia)';   $COLORTBL[49] = "#ffffcc";
$AREATBL[50] = '北アメリカ(North America)';   $COLORTBL[50] = "#ffffcc";
$AREATBL[51] = '南アメリカ(South America)';   $COLORTBL[51] = "#ffffcc";
$AREATBL[52] = 'オーストラリア(Australlia)';   $COLORTBL[52] = "#ffffcc";
$AREATBL[53] = 'その他';   $COLORTBL[53] = "#ffffcc";

上には上があるもんですなぁ、この場合上が何を指すのかが分かりませんが (ゥェ

@COLORTBL の方を左に書いた方が見た目が揃うのに』みたいな感想しか思い付きません。

Hash や、Array の Array にするとか色々方法が考えられますが、結局 print する丈けみたいなので、 Script の末尾で __END__ 以降に Tab 区切りかなにかで書いておいて while で取り出してみました。

print qq'<option value="$color">$area</option>\n'
    while ($area, $color) = split ' ', <DATA>;
__END__
北海道  #993300
#   :
#   :   長いので省略
#   :
その他  #ffffcc

何に使うのか判らなかったので、取り敢えず <option> にしておきました ;-)

if ( !(open(LOG,"+<$logfile")))    { &error("ログファイルのオープンに失敗しました"); }
@data = <LOG> ;
@data = sort { $a <=> $b} @data ;
@data = reverse @data ;
close(LOG);

Array に読み込んでから、昇順に sort して代入、 reverse してまた代入してますね。しかも、入出力用に開いたのに読み込んだ丈けで閉じてるという。

此の後 foreach で順に表示して終わる丈けなので、

open _, $logfile or error('ログファイルのオープンに失敗しました');
print sort { $b <=> $a } <_>;
close _;

でもよかったります。んで其の foreach 中でこれまた面白いのが出てきます。

$i = "%" . $edt_count . "d" ;
$cnt = sprintf("$i",$cnt) ;
for ( $i = 0 ; $i <= $edt_count - 1 ; $i++ ) {
    $j = substr($cnt,$i,1) ; 
    print "<img src=$numgif[$j] border=0>";
}

なんか、回りクドい亊してるのは判ったのですが、結局何なのかが解らなかったので Script の最初から読み直して見ると Counter の数字に設定した桁数分 0 (の画像) を追加しようとしているようでした。

どうも、中途半端に面白いなと思ったら、この Script は count.pl として、あちこちの Site で同じ物が公開されている Script を Copy して、ちょっと書き換えただけの様です。元の Script も面白 Script ですね (そして簡単に壊れる Counter です)。最初は誰が考えたんでしょうね。

print map qq!<img src="$numgif[$_]" border="0">!,
    split //, sprintf "%0${edt_count}d", $cnt;

unpack は他の書き換えで使ったので今度は split にしてみました。

なにがなんでも Array にしたくない

sub error {
    unlink($lock); unlink($lock_pwl);
    $error = $_[0];
    if    ($error eq "0") { $error_msg = '記録ファイルの入出力にエラーが発生しました。'; }
    elsif ($error eq "1") { $error_msg = 'お名前が記入されていません。'; }
    elsif ($error eq "2") { $error_msg = '内容が書かれていません。'; }
    elsif ($error eq "3") { $error_msg = 'メールアドレスが正しく入力されていません。'; }
    elsif ($error eq "4") { $error_msg = 'メールアドレスは複数指定できません。'; }
    elsif ($error eq "5") { $error_msg = 'パスワードが違います。'; }
    elsif ($error eq "6") { $error_msg = 'この投稿内容は手動で削除してください。';}
    print "Content-type: text/html\n\n";
    print "<html><head><title>$title</title></head>\n";
    print "$body\n";
    print "<h3>$error_msg</h3>\n";
    print "<a href=\"$cgi_name\">投稿画面に戻る</a>\n";
    print "</body></html>\n";
    exit;
}

unlink, print は一回で済む。$error_msg は要らない。

sub error
{
    unlink $lock, $lock_pwl;
    print 'Content-type: text/html; charset=Shift_JIS', "\x0D\x0A" x 2,
        qq'<!DOCTYPE html
    PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html lang="ja" dir="ltr">
<head>
    <title>$title</title>
</head>
$body
<h1>',  (qw{
        記録ファイルの入出力にエラーが発生しました。
        お名前が記入されていません。
        内容が書かれていません。
        メールアドレスが正しく入力されていません。
        メールアドレスは複数指定できません。
        パスワードが違います。
        この投稿内容は手動で削除してください。
    })[$_[0]],  qq'</h1>
<p><a href="$cgi_name">投稿画面に戻る</a></p>
</body>
</html>
';
    exit;
}
$body1 = '<BODY BGCOLOR="#003000" TEXT="#C0E0C0" LINK="#FF0000" ALINK="#FFFF00" VLINK="#FF0000">';
$body2 = '<BODY BGCOLOR="#003060" TEXT="#C0E0FF" LINK="#FF0000" ALINK="#FFFF00" VLINK="#FF0000">';
$body3 = '<BODY BGCOLOR="#306030" TEXT="#E0FFE0" LINK="#FF0000" ALINK="#FFFF00" VLINK="#FF0000">';
$body4 = '<BODY BGCOLOR="#603000" TEXT="#FFE0C0" LINK="#FF0000" ALINK="#FFFF00" VLINK="#FF0000">';
$body5 = '<BODY BGCOLOR="#003030" TEXT="#C0E0E0" LINK="#FF0000" ALINK="#FFFF00" VLINK="#FF0000">';
$body6 = '<BODY BGCOLOR="#000030" TEXT="#C0C0E0" LINK="#FF0000" ALINK="#FFFF00" VLINK="#FF0000">';
($sec, $min, $hour) = localtime(time);
if    ($hour <  4) { $body = $body1; } 
elsif ($hour <  8) { $body = $body2; }
elsif ($hour < 12) { $body = $body3; }
elsif ($hour < 16) { $body = $body4; }
elsif ($hour < 20) { $body = $body5; }
else               { $body = $body6; }
print "$body";

一文で出来るのに。

printf qq!<body bgcolor="#%s" text="#%s" link="#ff0000" alink="#ffff00" vlink="#ff0000">!, @{(
    [qw/003000 c0e0c0/],
    [qw/003060 c0e0ff/],
    [qw/306030 e0ffe0/],
    [qw/603000 ffe0c0/],
    [qw/003030 c0e0e0/],
    [qw/000030 c0c0e0/],
)[(localtime)[2] / 4]};
# ------------------------------------- 初期処理
use Time::Local;
($sec, $min, $hour, $mday, $mon, $year) = localtime(time);
# ------------------------------------- 初期設定
$xday   = '20100101';  # ---- カウントダウンする日付(YYYYMMDD)
$images = './images/'; # ---- GIFイメージのディレクトリ
# ----------------------------------- メイン処理
$xday =~ /(\d\d\d\d)(\d\d)(\d\d)/;
$yy = $1;
$mm = $2;
$dd = $3;
$src  = timelocal(0, 0, 0, $mday, $mon   , $year + 1900);
$dest = timelocal(0, 0, 0, $dd  , $mm - 1, $yy);
$span = ($dest - $src) / 86400;
if ($span >= 0) {
    my $str = '';
    for ($i = 0; $i < length($span); $i++) {
        $str .= "<IMG SRC=\"$images" . substr($span, $i, 1) . "\.gif\">";
    }
    print qq(<TABLE><TR><TD ALIGN="center">${yy}年${mm}月${dd}日 まで</TD><TD ALIGN="center">$str</TD><TD ALIGN="center">日です</TD></TR></TABLE>\n);
}

もう、おなかいっぱい。

use integer;
use Time::Local;
@_ = qw(d m y);
@_{@_} = (localtime)[3..5];
$_{y} += 1900;
my $src  = timelocal(0, 0, 0, @_{@_});
@_{@_[2,1,0]} = qw{2010 01 01}; # ---- カウントダウンする日付(YYYY MM DD)
$_{m} -= 1;
my $dest = timelocal(0, 0, 0, @_{@_});
(my $span = ($dest - $src) / 86400) >= 0
    and print "<div>$_{y}年$_{m}月$_{d}日 まで",
        map(qq!<img src="./images/$_.gif">!, split //, $span),
        "日です</div>\n";

抑々画像にする必要が無い……。

Arrey の様な Hash の様な…

# スパム防止キーと画像との関連付け
# 左側..防止キー(半角英数字のみ)
# 右側..対応する画像のパスまたはURL
# 複数行挿入可能
# [重要]サンプルをそのまま使わずに作り替える事
%spam = (
"507725", => "./0.gif",
"624537", => "./1.gif",
"472463", => "./2.gif",
"395722", => "./3.gif",
"903297", => "./4.gif",
);

不思議。=> 演算子ってのは , の同義語であると同時に左の識別子を文字列として扱うので、この場合は「double quote 文字列と、空の『何か』を文字列にする」という作用でしょうか。謎。

%spam = qw(
    507725  0.gif
    624537  1.gif
    472463  2.gif
    395722  3.gif
    903297  4.gif
);

なにがなんでも Hash を使いたくない

sub decode{ 
    $buffer = $ENV{'QUERY_STRING'};
    @pairs = split(/&/,$buffer);
    foreach $pair (@pairs) {
        ($name, $value) = split(/=/, $pair);
        $value =~ tr/+/ /;
        $value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg;
        &jcode'convert(*value,'sjis');
        $FORM{$name} = $value;
    }
    $url = $FORM{'url'};
    $name = $FORM{'name'};
}

お決まりの Query を Deocde するやつです。 折角 後で使う為に %FORM に入れたのに、直後に別の変数に入れて 2 度と出てきません。

sub decode
{
    for (split /&/, $ENV{QUERY_STRING})
    {
        my ($k, $v) = split /=/, $_, 2;
        next unless grep $k eq $_, qw{ name url }; # こういうのが必要かな?
        $v =~ tr/+/ /s;
        $v =~ s/%([0-9A-Fa-f]{2})/pack 'H2', $1/eg;
        jcode::convert(\$v, 'sjis', '', 'z');
        $$k = $v;
    }
}

これで無駄な Hash を作らずに済んで、同じ結果になったでしょう。此の手のは他にも幾らでも何処にでもある。

sub get_cookie{
    local($key,$value,$db,$db2);
    foreach (split(/; /,$ENV{HTTP_COOKIE})){
        ($key, $value) = split(/=/,$_);
        $db{$key} = $value;
    }
    $env = $db{env};
    foreach (split(/<>/,$env)){
        ($key, $value) = split(/:/,$_);
        $db2{$key} = $value;
    }
    $crce = $db2{crce};
    $md5e = $db2{md5e};
    $acte = $db2{acte};
    $acte = 1 if($acte eq '');
    $commente = $db2{commente};
    $commente = 1 if($commente eq '');
    $sizee = $db2{sizee};
    $sizee = 1 if($sizee eq '');
    $mimee = $db2{mimee};
    $datee = $db2{datee};
    $datee = 1 if($datee eq '');
    $anothere = $db2{anothere};
    $gzipence = $db2{gzipence};
    $gzipence = $gzipenc_def if($gzipence eq '');
}

もぅ……、local 宣言の hash の指定の仕方間違ってるし。大阪から京都に行くのに地球を西向きに回る様な遣り方に見えなくも無い。

sub get_cookie
{
    for (split /; /, $ENV{HTTP_COOKIE})
    {
        my ($k, $v) = split /=/, $_, 2;
        $k eq 'env' or next;
        for (split /<>/, $v)
        {
            my ($k, $v) = split /:/, $_, 2;
            $v = 1 if $v eq '' and grep $k eq $_, qw{ acte commente sizee datee };
            $$k = $v;
        }
    }
    $gzipence ||= $gzipenc_def;
}

こういう Cookie Get/Set を長々と書くのは MiniBBS v7 が元になってゐる事が多い様です。 個人的には 一時変数が多過ぎると却って読みにくい と思うのですが、如何なものでしょうか?

#--- クッキーの取得(独自方式)-----------------------#
$cookies = $ENV{'HTTP_COOKIE'};
@pairs = split(/;/,$cookies);
foreach $pair (@pairs) {
    ($name, $value) = split(/=/, $pair);
    $name =~ s/ //g;
    $DUMMY{$name} = $value;
}
@pairs = split(/,/,$DUMMY{$reload});
foreach $pair (@pairs) {
    ($name, $value) = split(/:/, $pair);
    $COOKIE{$name} = $value;
}
#-----------------------------------------------------#
#  クッキーの仕様通りに真面目にフォーマット(指定時刻はGMT)
#  クッキーの仕様書  http://www.netscape.com/newsref/std/cookie_spec.html
($secg,$ming,$hourg,$mdayg,$mong,$yearg,$wdayg,$ydayg,$isdstg) = gmtime(time + 30*24*60*60);# 期限を30日後に設定(GMT)
$y0="Sunday"; $y1="Monday"; $y2="Tuesday"; $y3="Wednesday"; $y4="Thursday"; $y5="Friday"; $y6="Saturday";
$m0="Jan"; $m1="Feb"; $m2="Mar"; $m3="Apr"; $m4="May"; $m5="Jun"; $m6="Jul"; $m7="Aug"; $m8="Sep"; $m9="Oct"; $m10="Nov"; $m11="Dec";
@youbi = ($y0,$y1,$y2,$y3,$y4,$y5,$y6);
@monthg = ($m0,$m1,$m2,$m3,$m4,$m5,$m6,$m7,$m8,$m9,$m10,$m11);
$date_gmt = sprintf("%s\, %02d\-%s\-%04d %02d:%02d:%02d GMT",$youbi[$wdayg],$mdayg,$monthg[$mong],$yearg +1900,$hourg,$ming,$secg);
#  独自方式のクッキーフォーマット
#
#  この簡易BBSでは名前とメールアドレスを保存の対象にしています。
#  それぞれを独立したクッキーとしてブラウザに食べさせればとても簡単ですが、
#  ブラウザがクッキーを格納できる数に制限があるため、できるだけ一つのクッキーに
#  保存データをまとめて食べさせることが望まれます。そのためにここでは独自の方法で
#  1つのクッキー内に複数のデータを詰め込み、クッキーの取得時にそれらを展開して利用しています。
#  
#  name:<name>,email:<email> という形式にまとめて、これを一つのクッキーとして
#  cookieという名前でブラウザに送信しています。
#
#  独自フォーマット  cookie=name:<name>,email:<email>
$cook="name\:$FORM{'name'}\,email\:$FORM{'email'}";
print "Set-Cookie: $reload=$cook; expires=$date_gmt\n";

一寸冗長ですね。「仕様書通り」が「真面目」なのかどうかは考えない亊にしても。

sub get_cookie
{
    for (split /; */, $ENV{HTTP_COOKIE})
    {
        my ($key, $value) = split /=/, $_, 2;
        next if $key ne $reload;
        for (split /,/, $value)
        {
            my ($k, $v) = split /:/, $_, 2;
            $v =~ s/%([a-fA-F0-9]{2})/pack 'H2', $1/eg;
            $COOKIE{$k} = $v;
        }
        last;
    }
}
sub set_cookie
{
    my @key = qw{ name email pwd };
    for (@key)
    {
        ($_{$_} = $FORM{$_}) =~ s/(\W)/'%' . unpack 'H2', $1/eg;
    }
    @_ = gmtime(time + 2592000);
    printf "Set-Cookie: %s=%s; expires=%s, %02d-%s-%d %02d:%02d:%02d GMT\x0D\x0A",
        $reload,
        join(',', map join(':', $_, $_{$_}), @key),
        (qw/Sunday Monday Tuesday Wednesday Thursday Friday Saturday/)[$_[6]],
        $_[3],
        (qw/Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec/)[$_[4]],
        $_[5] + 1900,
        @_[2,1,0];
}

MiniBBS 2000 等では既に冗長ではありませんが、更に短くしてみました。

なにがなんでも HTTP Header が嫌い

    print "Content-type: text/html\n\n";
    print <<"EOM";
<!DOCTYPE html
    PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html lang="ja">
<head>
<META HTTP-EQUIV="Content-type" CONTENT="text/html; charset=Shift_JIS">

http-equiv って元々 HTTP Header に付加する為の情報なので、

print 'Content-type: text/html; charset=Shift_JIS', "\x0D\x0A" x 2,
    <<"EOM";

にしないと意味無いでしょう。

おまけ: フレーム非対応のブラウザの方はご利用できません
だそうですが「ご利用」と來れば「戴けません」とかですね、日本語なら。 というか accessible で無いです。

こっちのは更に冗長になってます。

# 文字化け防止の Content-type
if ($kanjicode eq 'sjis') {
    $contenttype = "<META HTTP-EQUIV=\"Content-type\" CONTENT=\"text/html; charset=Shift_JIS\">";
    # $contenttype = "<META HTTP-EQUIV=\"Content-type\" CONTENT=\"text/html; charset=x-sjis\">";
} elsif ($kanjicode eq 'euc') {
    $contenttype = "<META HTTP-EQUIV=\"Content-type\" CONTENT=\"text/html; charset=EUC-JP\">";
    # $contenttype = "<META HTTP-EQUIV=\"Content-type\" CONTENT=\"text/html; charset=x-euc-jp\">";
} elsif ($kanjicode eq 'jis') {
    $contenttype = "<META HTTP-EQUIV=\"Content-type\" CONTENT=\"text/html; charset=iso-2022-jp\">";
}

同じ亊を何度も何度も何度も何度も何度も

$contenttype = '<META HTTP-EQUIV="Content-type" CONTENT="text/html; charset=' . {qw{
     euc EUC-JP
     jis ISO-2022-JP
    sjis Shift_JIS
    utf8 UTF-8
}}->{$kanjicode} . '">';

此れ丈けで済む。

なにがなんでも HTTP Header で嘘吐きたい

print "Content-type: image/gif\n\n";
print "<img src=$spacer_gif width=1 height=1>";

こ、怖い…… Content-type を鵜呑みにする Client とか Helper 起動すると落ちそうですね。というかある意味攻撃的ですよね。 まぁ GIF かどうかだけだったら先頭 6 bytes で簡単に判別出来るので、 大抵は単に不正な File として扱われるでしょうけど。

これは呼び出し元の HTML に TAG を書いて貰うものとして、 Location で飛ばすとかでしょうか。 Content-type: text/html で大丈夫とも思えないんですが、元々 Gif と HTML とどっちを要求されているのかが謎だったりします。しかも $spacer_gif が定義されてないという……。

print 'Location: ', $spacer_gif, "\x0D\x0A" x 2;

なにがなんでも sprintf を細切れにしたい

$raihoucnt = sprintf("%d",$cnt);    $edt = substr($svdate,4,2);
$edt = sprintf("%02d",$edt)."月";   $edt2 = substr($svdate,6,2);
$edt = $edt.sprintf("%02d",$edt2)."日";

どういう亊なんでしょうか…… sprintf の意味が……とほほ。

use integer;
$raihoucnt = $cnt; # 此の代入要るの?
$edt = sprintf '%02d月%02d日', substr($svdate, 4, 2), substr($svdate, 6, 2);

大体、元々 Data の設計が悪いから substr が必要になるんですけど。 Script より Data Format を良く考えないと、しなくていい苦労ばっかりしますから。

ぁあ、それと其処の Script に、

$buf=~ s/\./\\./g;      $buf=~ s/\?/\./g;       $buf=~ s/\*/\.\*/g;

というのが何回も出てきますが、後の 2 つの置換演算子では、置き換える文字列に不必要な Escape がありますが、最初のにはありません。

どうせやるなら普通に

for ($buf) {
    s/(?=\.)/\\/g;
    tr/?/./;
    s/(?=\*)/./g;
}

としたい処ですが、はて、これは何がしたいのかやっぱり謎なんです。 quotemeta では駄目なんでしょうか?

($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(time);
$year = sprintf("%02d",$year + 1900);
$month= sprintf("%02d",$mon + 1);
$mday = sprintf("%02d",$mday);
$hour = sprintf("%02d",$hour);
$min  = sprintf("%02d",$min);
$sec  = sprintf("%02d",$sec);
if ( substr($month,0,1) == 0 )  {   $month =~ s/0/ /;   }
if ( substr($mday,0,1) == 0 )   {   $mday =~ s/0/ /;    }
$week = ('Sun','Mon','Tue','Wed','Thu','Fri','Sat') [$wday];
$today = "$year/$month/$mday($week) $hour:$min";

11 行中 9 蟯虫でした。

@_ = localtime;
$today = sprintf '%d/%2d/%2d(%s) %02d:%02d',
    $_[5] + 1900,
    $_[4] + 1,
    $_[3],
    (qw/Sun Mon Tue Wed Thu Fri Sat/)[$_[6]],
    @_[2,1];

どういう訳だか皆さん日付の処理が廻り諄い。

sub getcookie{ #####クッキーの取得
    $cooks = $ENV{'HTTP_COOKIE'};
    $cooks = '' unless($cooks =~ s/.*$cookie_name=(.*)$end.*/$1/);
    ($name,$mail,$color,$reroad,$line,$reset) = split('\t', $cooks);
} ##### sub getcookie おわり
sub setcookie{ #####クッキーの送信
$ENV{'TZ'} = "GMT";
## クッキーを消化する時刻を設定(30*24*60*60 : 30日後)
($secg,$ming,$hourg,$mdayg,$mong,$yearg,$wdayg,$ydayg,$isdstg) = localtime(time + 30*24*60*60);
    if ($yearg < 10)  { $yearg = "0$yearg"; }
    if ($secg < 10)   { $secg  = "0$secg";  }
    if ($ming < 10)   { $ming  = "0$ming";  }
    if ($hourg < 10)  { $hourg = "0$hourg"; }
    if ($mdayg < 10)  { $mdayg = "0$mdayg"; }
    $y0="Sun"; $y1="Mon"; $y2="Tue"; $y3="Wed"; $y4="Thu"; $y5="Fri"; $y6="Sat";
    $youbi = ($y0,$y1,$y2,$y3,$y4,$y5,$y6) [$wdayg];
    $m0="Jan"; $m1="Feb"; $m2="Mar"; $m3="Apr"; $m4="May"; $m5="Jun";
    $m6="Jul"; $m7="Aug"; $m8="Sep"; $m9="Oct"; $m10="Nov"; $m11="Dec";
    $month = ($m0,$m1,$m2,$m3,$m4,$m5,$m6,$m7,$m8,$m9,$m10,$m11) [$mong];
    $date_gmt = "$youbi, $mdayg\-$month\-$yearg $hourg:$ming:$secg GMT";
$cookie = "$name\t$mail\t$color\t$reroad\t$line\t$reset\t$end";
print "Set-Cookie: $cookie_name=$cookie";
print ";expires=$date_gmt";
} #####sub setcookieの(おわり)

態々 timezone を GMT に set してから localtime って何がしたいんだか……。

sub getcookie
{
    ($name, $mail, $color, $reroad, $line, $reset) =
        split /\t/, $ENV{HTTP_COOKIE} =~ /$cookie_name=(.*)$end/;
}
sub setcookie
{
    @_ = gmtime(time + 2592000);
    printf "Set-Cookie: %s=%s; expires=%s, %02d-%s-%d %02d:%02d:%02d GMT\x0D\x0A",
        $cookie_name,
        join("\t", $name, $mail, $color, $reroad, $line, $reset, $end),
        (qw/Sun Mon Tue Wed Thu Fri Sat/)[$_[6]], $_[3],
        (qw/Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec/)[$_[4]],
        $_[5] + 1900, @_[2, 1, 0];
}
sub get_date {
    $ENV{'TZ'} = $_[0] ? $_[0] : $tz;
    local($sec,$min,$hour,$day,$mon,$year,$youbi) = localtime(time);
    $mon++;
    if ($sec  < 10) { $sec  = "0$sec";  }
    if ($min  < 10) { $min  = "0$min";  }
    if ($hour < 10) { $hour = "0$hour"; }
    if ($day  < 10) { $day  = "0$day";  }
    if ($mon  < 10) { $mon  = "0$mon";  }
    $year += 1900;
    $youbi = ('Sun','Mon','Tue','Wed','Thu','Fri','Sat')[$youbi];
    return ($year,$mon,$day,$hour,$min,$sec,$youbi);
}
sub get_date
{
    $ENV{TZ} = $_[0] || $tz;
    @_ = localtime;
    $_[5] + 1900, map(sprintf("%02d", $_), $_[4] + 1, @_[3, 2, 1, 0]),
        (qw/Sun Mon Tue Wed Thu Fri Sat/)[$_[6]];
}
# クッキー記録
sub set_cookie
{
    # クッキーの有効期限を30日にする
    local ($csec, $cmin, $chour, $cmday, $cmon, $cyear, $cwday) = gmtime(time + 30 * 24 * 60 * 60);
    $cyear = $cyear + 1900;
    $cmday = sprintf("%.2d", $cmday);
    $chour = sprintf("%.2d", $chour);
    $cmin = sprintf("%.2d", $cmin);
    $csec = sprintf("%.2d", $csec);
    $cmon = ('Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec')[$cmon];
    $cwday = ('Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday')[$cwday];
    $date_gmt = "$cwday, $cmday\-$cmon\-$cyear $chour:$cmin:$csec GMT";
    local ($cook) = "name\#$FORM{'name'}\,mail\#$FORM{'mail'}\,hpurl\#$FORM{'hpurl'}";
    print "Set-Cookie: $cookie_name=$cook; expires=$date_gmt\n";
}

二文で出来ますョ。何の為の local なんだか……。

sub set_cookie
{
    @_ = gmtime(time + 2592000);    # クッキーの有効期限を30日にする
    printf "Set-Cookie: %s=%s; expires=%s, %.2d-%s-%d %.2d:%.2d:%.2d GMT\x0D\x0A",
        $cookie_name,
        join(',', map join('#', $_, $FORM{$_}), qw/name mail hpurl/),
        (qw'Sunday Monday Tuesday Wednesday Thursday Friday Saturday')[$_[6]],
        $_[3],
        (qw'Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec')[$_[4]],
        $_[5] + 1900, @_[2,1,0];
}
# [現在時刻を取得]
sub time{
  $ENV{'TZ'} = "JST-9";
  ($sec,$min,$hour,$mday,$mon,$year,$wday) = localtime();
  $year = $year + 1900;
  $mon = sprintf("%.2d",$mon +1);
  $mday = sprintf("%.2d",$mday);
  $hour = sprintf("%.2d",$hour);
  $min = sprintf("%.2d",$min);
  $sec = sprintf("%.2d",$sec);
# 曜日を日本語化
  @week = ('日','月','火','水','木','金','土');
  $wday = $week[$wday];
  local($date) = "$year年$mon月$mday日($wday) $hour時$min分$sec秒";
  return ($date);
}

三文で出来ますョ。

sub time # 何故に此の名前?
{
    $ENV{TZ} = 'JST-9';
    @_ = localtime;
    sprintf '%d年%.2d月%.2d日(%s) %.2d時%.2d分%.2d秒',
        $_[5] + 1900, $_[4] + 1, $_[3],
        (qw(日 月 火 水 木 金 土))[$_[6]],
        @_[2,1,0];
}
( $sec,$min,$hour,$day,$mon,$year,$wday ) = localtime(time);
    $mon++;
$wday = ('日','月','火','水','木','金','土')[$wday];
$year = $year + 1900;
open(OUT,"$datafile") || die "Can't Open Count Data File\n";
$line1 = <OUT>;
$line2 = <OUT>;
$line3 = <OUT>;
close(OUT);
$line1 =~ s/\r\n//g;
$line1 =~ s/\n//g;
$line2 =~ s/\r\n//g;
$line2 =~ s/\n//g;
$line3 =~ s/\r\n//g;
$line3 =~ s/\n//g;
if($line3 != $day){
open(IN,">$datafile") || die "Can't Open Count Data File For Writing\n";
print IN "0\n";
print IN "$line1\n";
print IN "$day\n";
close(IN);
open(OUT,"$datafile") || die "Can't Open Count Data File\n";
$line1 = <OUT>;
$line2 = <OUT>;
$line3 = <OUT>;
close(OUT);
$line1 =~ s/\r\n//g;
$line1 =~ s/\n//g;
$line2 =~ s/\r\n//g;
$line2 =~ s/\n//g;
$line3 =~ s/\r\n//g;
$line3 =~ s/\n//g;
$line1 = $line1 +1;
open(IN,">$datafile") || die "Can't Open Count Data File For Writing\n";
print IN "$line1\n";
print IN "$line2\n";
print IN "$line3\n";
close(IN);
}else{
$line1 = $line1 +1;
open(OUT,">$datafile") || die "Can't Open Count Data File For Writing\n";
print OUT "$line1\n";
print OUT "$line2\n";
print OUT "$line3\n";
close(OUT);
}
print <<EOF; 
只今、$year年$mon月$day日-$wday曜日-$hour時$min分$sec秒です。<br>
昨日のカウント数は、$line2です。<br>
本日、只今までのカウント数は、$line1です。<br>
EOF

なぁ〜んじゃこら??? 入れて出して入れて出して入れて出して入れて出して入れて出して……

if (open _, "+< $datafile")
{
    flock _, 2;
    chomp(@_ = <_>);
    $_[2] != $day and @_ = (0 , $_[0], (localtime)[3]);
    $_[0]++;
    seek _, 0, 0;
    print _ join $\, @_, '';
    truncate _, tell;
    close _;
}
print <<"."; 
<p>只今、${\scalar localtime}です。</p>
<p>昨日のカウント数は、$line[1]です。</p>
<p>本日、只今までのカウント数は、$line[0]です。</p>
.

と、してみましたが、改行より別の Delimiter の方が便利でしょうね。

for ($i = 0 ;$i <= $Len - 1;$i++){
    $Red{'color'} = $Red{'color'} + $Red{'level'};
    $Green{'color'} = $Green{'color'} + $Green{'level'};
    $Blue{'color'} = $Blue{'color'} + $Blue{'level'};
    if ($i < $Len - 1 ){
        $FColor = sprintf("%02X", $Red{'color'})
                . sprintf("%02X", $Green{'color'})
                . sprintf("%02X", $Blue{'color'})
    } else {
        $FColor = $ColorTo;
    }
    $FColor = lc $FColor;
    $TagStr = $TagStr . $StaTag . $FColor . ';">' . &KcharAt($Str, $i + 1) . $EndTag;
}

sprintf の format を大文字 Hexadecimal で指定してから lc で小文字に直すとか、こういうの意味解らん。

for $i (0 .. $Len - 1)
{
    $TagStr .= $StaTag . (
        $i == $Len - 1 ? lc $ColorTo : sprintf '%02x%02x%02x',
            $Red{color}   + $Red{level},
            $Green{color} + $Green{level},
            $Blue{color}  + $Blue{level}
        ) .';">' . &KcharAt($Str, $i + 1) . $EndTag;
}

なにがなんでも substr が使いたい

$hint = ($u cmp substr($BOOK[$current],19,4));
if($hint == 0){
    local($j) = substr($BOOK[$current],$charposition,4);
    return (pack("C",hex(substr($j,0,2))) . pack("C",hex(substr($j,2,2))));
}
$hint = ($u cmp substr($BOOK8[$current],19,6));
if($hint == 0){
    local($j) = substr($BOOK8[$current],$charposition8,4);
    return (pack("C",hex(substr($j,0,2))) . pack("C",hex(substr($j,2,2))));
}

先づ 4 bytes 取り出してから 2 bytes づつ pack して其れを連接してゐますが、此れでいいんでは?

$hint or return pack 'H4', substr $BOOK[$current], $charposition, 4;
$s =~ s/%u([0-9a-fA-F]{4})/&decodeutf16($1)/eg;
#   : snip
sub decodeutf16(){
    local($u) = $_[0];
    $u =~ tr/[a-f]/[A-F]/;
    return (pack("C",hex(substr($u,0,2))) . pack("C",hex(substr($u,2,2))));
}

decodeutf16() 自体が要らない。

$s =~ s/%u([0-9a-fA-F]{4})/pack 'H4', $1/eg;
# 若しくは
sub decodeutf16 { pack 'H4', $_[0]; }

というかコピペして変数名に 8 付ける丈けとか止めて欲っすぃ。

if (($absec_now - &absec(substr($number,0,4),substr($number,4,2),substr($number,6,2),substr($number,9,2),substr($number,11,2),substr($number,13,2))) < $update *86400) { $new = $new_str;} else { $new = '';}
$new = ($absec_now - &absec(
        unpack 'A4' . ('A2' x 5), substr($number, 0, 14)
    )) < $update * 86400 ? $new_str : '';
local($yyyy,$mm,$dd,$wd,$hour,$minute,$second) = (
    substr($n,0,4),
    substr($n,4,2),
    substr($n,6,2),
    substr($n,8,1),
    substr($n,9,2),
    substr($n,11,2),
    substr($n,13,2) );
my ($yyyy, $mm, $dd, $wd, $hour, $minute, $second) =
    unpack 'A4 A2 A2 A1 A2 A2 A2', substr($n, 0, 15);
$tmp = sprintf("S:%d,%s,%02d/%02d/%02d,%02d:%02d,\n",
    $num,
    $reply,
    substr($number,2,2),substr($number,4,2),substr($number,6,2),
    substr($number,8,2),substr($number,10,2) );
$tmp = sprintf "S:%d,%s,%02d/%02d/%02d,%02d:%02d,\n",
    $num, $reply,
    unpack 'A2' x 5, substr($number, 2, 10);

List 代入や sprintf 文で、同じ変数に対して substr が数回繰り返されていますが、連続した文字ですので unpack を使えば一文で書けますね。他にも何度も substr の連続が出てきます。

$iw=ord(substr($object,$byte,1))+ord(substr($object,$byte+1,1))*256;$byte+=2;
$ih=ord(substr($object,$byte,1))+ord(substr($object,$byte+1,1))*256;$byte+=2;

ぉぃぉぃ、なんでやねん、勘辯してくれよ。

($iw, $ih) = unpack 'vv', substr($object, $byte += 4, 4);

なにがなんでも sub にしたい

# -------------------------------------
sub by_agent {
    if ($agent{$b} != $agent{$a}) {
        $agent{$b} <=> $agent{$a};
    }
    else {
        $a <=> $b;
    }
}
# -------------------------------------
sub by_referer {
    if ($referer{$b} != $referer{$a}) {
        $referer{$b} <=> $referer{$a};
    }
    else {
        $a <=> $b;
    }
}
# -------------------------------------
sub by_host {
    if ($host{$b} != $host{$a}) {
        $host{$b} <=> $host{$a};
    }
    else {
        $a <=> $b;
    }
}
# -------------------------------------

三つに分けなくていいのに。if 文は要らないので、結局こうなります。

sub by_agent   { $agent{$b}   <=> $agent{$a}   || $a <=> $b; }
sub by_referer { $referer{$b} <=> $referer{$a} || $a <=> $b; }
sub by_host    { $host{$b}    <=> $host{$a}    || $a <=> $b; }

sort に inline で書いた方が解り易くない?

sub bura_check{
  $ad_width = 50; $name_width = 20; $com_width = 50;
  $agent = $ENV{'HTTP_USER_AGENT'};
  if ($agent =~ /MSIE 3/i || $agent =~ /MSIE 4/i || $agent =~ /MSIE 5/i) {
    $ad_width = $ad_width * 1.2;
    $name_width = $name_width * 1.5;
    $com_width = $com_width * 1.1;
  }
  return ($ad_width,$name_width,$com_width);
}

えぇっ?

sub bura_check
{
    $ENV{HTTP_USER_AGENT} =~ /MSIE [3-5]/i ? (60, 30, 55) : (50, 20, 50);
}

Style Sheet を使うと此の処理自体が要らない。

なにがなんでも sub に Prototype を附けたい

#input : year,month
sub days_from_month()
{
local(@days,$year,$r);
   @days = (0,31,28,31,30,31,30,31,31,30,31,30,31);
   $r = $days[$_[1]];
   if($_[1] == 2){
      if($_[0]%4==0 && $_[0]%100>0){ $r++; }
      elsif($_[0]%400==0){ $r++; }
   }
   $r;
}

$_[0], $_[1] を使ってゐるということは引数を期待してゐるのに Prototype 附き sub routine 宣言で“引数無し”(括弧が空) を指定してゐる。つまり

days_from_month $year, $month;

の樣に呼び出せる筈のところを $year, $month が引数ではなくなるので、期待通りには Parse しなくなる。

# Scalar found where operator expected, at end of line
#   (Do you need to predeclare days_from_month?)
# syntax error, near "days_from_month $year"

結局、 呼び出しには必ず括弧を附けなければならなくなる。こんなやゝこしい書き方をせず、宣言無し sub routine にしとけばよかったのに。

sub days_from_month($$)
{
    (undef, 31,
        $_[0] % 100 == 0 && $_[0] % 400 != 0 || $_[0] % 4 != 0 ? 28 : 29,
        31, 30, 31, 30, 31, 31, 30, 31, 30, 31)[$_[1]];
}

なにがなんでもコピペしたい

# ファイル形式を認識
$flag=0;
if ($tail =~ /image\/gif/i && $gif) { $tail=".gif"; $flag=1; }
if ($tail =~ /image\/jpeg/i && $jpeg) { $tail=".jpg"; $flag=1; }
if ($tail =~ /image\/x-png/i && $png) { $tail=".png"; $flag=1; }
if ($tail =~ /text\/plain/i && $text) { $tail=".txt"; $flag=1; }
if ($tail =~ /lha/i && $lha) { $tail=".lzh"; $flag=1; }
if ($tail =~ /zip/i && $zip) { $tail=".zip"; $flag=1; }
if ($tail =~ /pdf/i && $pdf) { $tail=".pdf"; $flag=1; }
if ($tail =~ /audio\/.*mid/i && $midi) { $tail=".mid"; $flag=1; }
if ($tail =~ /msword/i && $word) { $tail=".doc"; $flag=1; }
if ($tail =~ /ms-excel/i && $excel) { $tail=".xls"; $flag=1; }
if ($tail =~ /ms-powerpoint/i && $ppt) { $tail=".ppt"; $flag=1; }
if ($tail =~ /audio\/.*realaudio/i && $ram) { $tail=".ram"; $flag=1; }
if ($tail =~ /application\/.*realmedia/i && $rm) { $tail=".rm"; $flag=1; }
if ($tail =~ /video\/.*mpeg/i && $mpeg) { $tail=".mpg"; $flag=1; }
if ($tail =~ /audio\/.*mpeg/i && $mp3) { $tail=".mp3"; $flag=1; }
if (!$flag) {
    if ($fname =~ /\.gif$/i && $gif) { $tail=".gif"; $flag=1; }
    if (($fname =~ /\.jpe?g$/i && $jpeg)) { $tail=".jpg"; $flag=1; }
    if ($fname =~ /\.png$/i && $png) { $tail=".png"; $flag=1; }
    if ($fname =~ /\.lzh$/i && $lha) { $tail=".lzh"; $flag=1; }
    if ($fname =~ /\.txt$/i && $text) { $tail=".txt"; $flag=1; }
    if ($fname =~ /\.zip$/i && $zip) { $tail=".zip"; $flag=1; }
    if ($fname =~ /\.pdf$/i && $pdf) { $tail=".pdf"; $flag=1; }
    if ($fname =~ /\.mid$/i && $midi) { $tail=".mid"; $flag=1; }
    if ($fname =~ /\.doc$/i && $word) { $tail=".doc"; $flag=1; }
    if ($fname =~ /\.xls$/i && $excel) { $tail=".xls"; $flag=1; }
    if ($fname =~ /\.ppt$/i && $ppt) { $tail=".ppt"; $flag=1; }
    if ($fname =~ /\.ram$/i && $ram) { $tail=".ram"; $flag=1; }
    if ($fname =~ /\.rm$/i && $rm) { $tail=".rm"; $flag=1; }
    if ($fname =~ /\.mpe?g$/i && $mpeg) { $tail=".mpg"; $flag=1; }
    if ($fname =~ /\.mp3$/i && $mp3) { $tail=".mp3"; $flag=1; }
}

$fname$tail は略同じ、 $flag は真偽値のみなので、 MIME Type らしき変数名を変えないといけませんが、一文で出来そうです。

$fname =~ m/\.([a-zA-Z0-9]+)$/i and grep $1 eq $_, qw{
    doc gif jpg lzh mid mp3 mpg pdf png ppt ram rm txt xls zip
} and $flag = $tail = ".$1";
if (!open(INI,"$setfile")) {    &error("ファイルの読み込みに失敗しました。$setfileが存在しません。");}
@lines = <INI>;
close(INI);
#各種設定値を取得
foreach $line (@lines) {
    $line =~ s/\"/\'/g;
    if ($line =~ /\$titlename = '(.*)'/) {          $titlename = $1;
    } elsif ($line =~ /\$titlelogo = '(.*)'/) {     $titlelogo = $1;
    } elsif ($line =~ /\$backpicture = '(.*)'/) {   $backpicture = $1;
    } elsif ($line =~ /\$bgcolor = '(.*)'/) {       $bgcolor = $1;
    } elsif ($line =~ /\$moto_bgcolor = '(.*)'/) {  $moto_bgcolor = $1;
    } elsif ($line =~ /\$moto_txcolor = '(.*)'/) {  $moto_txcolor = $1;
    } elsif ($line =~ /\$res_bgcolor = '(.*)'/) {   $res_bgcolor = $1;
    } elsif ($line =~ /\$res_txcolor = '(.*)'/) {   $res_txcolor = $1;
    } elsif ($line =~ /\$titlecolor = '(.*)'/) {    $titlecolor = $1;
    } elsif ($line =~ /\$textcolor = '(.*)'/) {     $textcolor = $1;
    } elsif ($line =~ /\$namecolor = '(.*)'/) {     $namecolor = $1;
    } elsif ($line =~ /\$icon_szw = '(.*)'/) {      $icon_szw = $1;
    } elsif ($line =~ /\$icon_szh = '(.*)'/) {      $icon_szh = $1;
    } elsif ($line =~ /\$icon_use = '(.*)'/) {      $icon_use = $1;
    } elsif ($line =~ /\$linkcolor = '(.*)'/) {     $linkcolor = $1;
    } elsif ($line =~ /\$vlinkcolor = '(.*)'/) {    $vlinkcolor = $1;
    } elsif ($line =~ /\$alinkcolor = '(.*)'/) {    $alinkcolor = $1;
    } elsif ($line =~ /\$hovercolor = '(.*)'/) {    $hovercolor = $1;
    } elsif ($line =~ /\$pt = '(.*)'/) {            $pt = $1;
    } elsif ($line =~ /\$url = '(.*)'/) {           $url = $1;      #i010117
    } else  {
        if ($line =~ /icon_gif.*'(.*)'/) {  if ( $sw1 == 0 ) {  $sw1 = 1 ; $j = 0 ; }   $icon_gif[$j] = $1; }
        if ($line =~ /iconnm.*'(.*)'/) {    if ( $sw2 == 0 ) {  $sw2 = 1 ; $j = 0 ; }   $iconnm[$j] = $1;   }
        if ($line =~ /icon_o_gif.*'(.*)'/) {    if ( $sw3 == 0 ) {  $sw3 = 1 ; $j = 0 ; }   $icon_o_gif[$j] = $1;   }
        if ($line =~ /icon_o_nm.*'(.*)'/) { if ( $sw4 == 0 ) {  $sw4 = 1 ; $j = 0 ; }   $icon_o_nm[$j] = $1;    }
        $j++;
    }
}

代入文は正規表現で取り出すけど、変数名は取り出さない。 require 出来そうなので、 $setfile の末尾に一行付ければよいです。

1;
#入力フォームの各項目見出しに、ダウンロードした画像をそのまま
#使用する場合は、GIFを置くパスだけ修正してね
$gif_name           = './kakikomitai_name.gif';     #入力フォーム(name)
$gif_email          = './kakikomitai_email.gif';    #入力フォーム(email)
$gif_home           = './kakikomitai_homepage.gif'; #入力フォーム(homepage)
$gif_title          = './kakikomitai_title.gif';    #入力フォーム(title)
$gif_message        = './kakikomitai_message.gif';  #入力フォーム(message)

此れ作ってる時って面倒臭く無いのかなぁ。不思議。一寸書き換えが必要になる ($gif_home$gif{homepage}) けど、こういう感じの方が使い易く無い?

%gif = map { $_ => "./kakikomitai_$_.gif" } qw/ name email homepage title message /;

変数名を其の儘使うならこんな感じ?

for (qw/name email homepage title message/)
{
    ${'gif_' . ($_ eq 'homepage' ? 'home' : $_)} = "./kakikomitai_$_.gif";
}
#↓訪問者用アイコンとアイコンの名前の指定。$icon_gif[3]...[10]のように適当に増やして下さいね。
$icon_gif[0] = './ball.gif' ;       $iconnm[0] = 'ボール' ;
$icon_gif_w[0] = 32 ; $icon_gif_h[0] = 32 ;
$icon_gif[1] = './corgi.gif' ;      $iconnm[1] = 'コーギー' ;
$icon_gif_w[1] = 32 ; $icon_gif_h[1] = 32 ;
$icon_gif[2] = './cow.gif' ;        $iconnm[2] = 'うし' ;
$icon_gif_w[2] = 32 ; $icon_gif_h[2] = 32 ;
$icon_gif[3] = './denchi.gif' ; $iconnm[3] = '電池' ;
$icon_gif_w[3] = 32 ; $icon_gif_h[3] = 32 ;
$icon_gif[4] = './dorayaki.gif' ;   $iconnm[4] = 'ドラ焼き' ;
$icon_gif_w[4] = 32 ; $icon_gif_h[4] = 32 ;
$icon_gif[5] = './duck.gif' ;       $iconnm[5] = 'あひる' ;
$icon_gif_w[5] = 32 ; $icon_gif_h[5] = 32 ;
$icon_gif[6] = './h_bambi.gif' ;    $iconnm[6] = 'バンビ' ;
$icon_gif_w[6] = 32 ; $icon_gif_h[6] = 32 ;
$icon_gif[7] = './h_bear.gif' ; $iconnm[7] = 'くま' ;
$icon_gif_w[7] = 32 ; $icon_gif_h[7] = 32 ;
$icon_gif[8] = './h_kaeru.gif' ;    $iconnm[8] = 'かえる' ;
$icon_gif_w[8] = 32 ; $icon_gif_h[8] = 32 ;
$icon_gif[9] = './h_momo.gif' ; $iconnm[9] = 'モモ' ;
$icon_gif_w[9] = 32 ; $icon_gif_h[9] = 32 ;
$icon_gif[10] = './h_saru.gif' ;    $iconnm[10] = 'さる1号' ;
$icon_gif_w[10] = 32 ; $icon_gif_h[10] = 32 ;

此れも同じ事。此処のはこういうので溢れてる。

@icon = (
    {qw{ _gif_h 32 _gif_w 32 _gif ./ball.gif     nm ボール }},
    {qw{ _gif_h 32 _gif_w 32 _gif ./corgi.gif    nm コーギー }},
    {qw{ _gif_h 32 _gif_w 32 _gif ./cow.gif      nm うし }},
    {qw{ _gif_h 32 _gif_w 32 _gif ./denchi.gif   nm 電池 }},
    {qw{ _gif_h 32 _gif_w 32 _gif ./dorayaki.gif nm ドラ焼き }},
    {qw{ _gif_h 32 _gif_w 32 _gif ./duck.gif     nm あひる }},
    {qw{ _gif_h 32 _gif_w 32 _gif ./h_bambi.gif  nm バンビ }},
    {qw{ _gif_h 32 _gif_w 32 _gif ./h_bear.gif   nm くま }},
    {qw{ _gif_h 32 _gif_w 32 _gif ./h_kaeru.gif  nm かえる }},
    {qw{ _gif_h 32 _gif_w 32 _gif ./h_momo.gif   nm モモ }},
    {qw{ _gif_h 32 _gif_w 32 _gif ./h_saru.gif   nm さる1号 }},
);
# $icon_gif[0]   ⇒ $icon[0]->{_gif}
# $iconnm[0]     ⇒ $icon[0]->{nm}
# $icon_gif_w[0] ⇒ $icon[0]->{_gif_w}
# $icon_gif_h[0] ⇒ $icon[0]->{_gif_h}
#カウンター用画像を使う場合、画像のIMGタグを指定。src=の後ろに画像のパスを指定してね。画像サイズがわからない場合は、width〜、height〜の部分は消してください。
#画像ファイル名の指定方法は、src=http://www.〜/xxx.gifというように設定したほうが確実ですよ。
#画像を使わない場合はテキストカウンターとなります。この場合、以下を''として下さい。
$cnt_gif[0]                 = '<img src=num6_0.gif width=25 height=30>';
$cnt_gif[1]                 = '<img src=num6_1.gif width=25 height=30>';
$cnt_gif[2]                 = '<img src=num6_2.gif width=25 height=30>';
$cnt_gif[3]                 = '<img src=num6_3.gif width=25 height=30>';
$cnt_gif[4]                 = '<img src=num6_4.gif width=25 height=30>';
$cnt_gif[5]                 = '<img src=num6_5.gif width=25 height=30>';
$cnt_gif[6]                 = '<img src=num6_6.gif width=25 height=30>';
$cnt_gif[7]                 = '<img src=num6_7.gif width=25 height=30>';
$cnt_gif[8]                 = '<img src=num6_8.gif width=25 height=30>';
$cnt_gif[9]                 = '<img src=num6_9.gif width=25 height=30>';

なんとしても ALT が無いんゃけど。はぁ。

@cnt_gif = map qq'<img alt="$_" src="num6_$_.gif">', 0 .. 9;
$ANS01++ if ( $j == 1 && $wk == $wk2 && $wk ne ''&& $wk2 ne '') ;
$ANS02++ if ( $j == 2 && $wk == $wk2 && $wk ne ''&& $wk2 ne '') ;
$ANS03++ if ( $j == 3 && $wk == $wk2 && $wk ne ''&& $wk2 ne '') ;
$ANS04++ if ( $j == 4 && $wk == $wk2 && $wk ne ''&& $wk2 ne '') ;
$ANS05++ if ( $j == 5 && $wk == $wk2 && $wk ne ''&& $wk2 ne '') ;
$ANS06++ if ( $j == 6 && $wk == $wk2 && $wk ne ''&& $wk2 ne '') ;
$ANS07++ if ( $j == 7 && $wk == $wk2 && $wk ne ''&& $wk2 ne '') ;
$ANS08++ if ( $j == 8 && $wk == $wk2 && $wk ne ''&& $wk2 ne '') ;
$ANS09++ if ( $j == 9 && $wk == $wk2 && $wk ne ''&& $wk2 ne '') ;
$ANS10++ if ( $j == 10 && $wk == $wk2 && $wk ne ''&& $wk2 ne '') ;

10 回 Paste しただけみたいですが 10 行全部で 10 回調べてますね。 $ANS10 なんて変数はやめて Array にすると簡単そうなのにね。

if ($wk == $wk2 && $wk . $wk2 ne '')
{
    for (1 .. 10)
    {
        ${'ANS' . $_} += $j == $_;
    }
}
if($CoParm{'ncolor'} eq ''){
    $i = 0;
    foreach (split(/\:/,$CFG{'colorpal'})){
        if($_ ne ''){
            if($i == 0){
                print "<input type=\"radio\" name=\"ncolor\" value=\"$_\" checked><font color=\"$_\">■</font> ";
            }
            else{
                print "<input type=\"radio\" name=\"ncolor\" value=\"$_\"><font color=\"$_\">■</font> ";
            }
            $i++;
        }
    }
}
else{
    $cf = 0;
    foreach (split(/\:/,$CFG{'colorpal'})){
        if($CoParm{'ncolor'} eq $_){ $cf = 1; }
    }
    if($cf){
        foreach (split(/\:/,$CFG{'colorpal'})){
            if($_ ne ''){
                if($CoParm{'ncolor'} eq $_){
                    print "<input type=\"radio\" name=\"ncolor\" value=\"$_\" checked><font color=\"$_\">■</font> ";
                }
                else{
                    print "<input type=\"radio\" name=\"ncolor\" value=\"$_\"><font color=\"$_\">■</font> ";
                }
            }
        }
    }
    else{
        $i = 0;
        foreach (split(/\:/,$CFG{'colorpal'})){
            if($_ ne ''){
                if($i == 0){
                    print "<input type=\"radio\" name=\"ncolor\" value=\"$_\" checked><font color=\"$_\">■</font> ";
                }
                else{
                    print "<input type=\"radio\" name=\"ncolor\" value=\"$_\"><font color=\"$_\">■</font> ";
                }
                $i++;
            }
        }
    }
}
print <<EOM;
一覧以外(優先色) <input type="text" name="nmycol" size="12" value="$CoParm{'nmycol'}"><br>文字色
EOM
if($CoParm{'tcolor'} eq ''){
    $i = 0;
    foreach (split(/\:/,$CFG{'colorpal'})){
        if($_ ne ''){
            if($i == 0){
                print "<input type=\"radio\" name=\"tcolor\" value=\"$_\" checked><font color=\"$_\">■</font> ";
            }
            else{
                print "<input type=\"radio\" name=\"tcolor\" value=\"$_\"><font color=\"$_\">■</font> ";
            }
            $i++;
        }
    }
}
else{
    $cf = 0;
    foreach (split(/\:/,$CFG{'colorpal'})){
        if($CoParm{'tcolor'} eq $_){ $cf = 1; }
    }
    if($cf){
        foreach (split(/\:/,$CFG{'colorpal'})){
            if($_ ne ''){
                if($CoParm{'tcolor'} eq $_){
                    print "<input type=\"radio\" name=\"tcolor\" value=\"$_\" checked><font color=\"$_\">■</font> ";
                }
                else{
                    print "<input type=\"radio\" name=\"tcolor\" value=\"$_\"><font color=\"$_\">■</font> ";
                }
            }
        }
    }
    else{
        $i = 0;
        foreach (split(/\:/,$CFG{'colorpal'})){
            if($_ ne ''){
                if($i == 0){
                    print "<input type=\"radio\" name=\"tcolor\" value=\"$_\" checked><font color=\"$_\">■</font> ";
                }
                else{
                    print "<input type=\"radio\" name=\"tcolor\" value=\"$_\"><font color=\"$_\">■</font> ";
                }
                $i++;
            }
        }
    }
}

あー、びっくりした。 このまま $CFG{'colorpal'} が永遠に続くのかと思った。

my @colorpal = split /:+/, $CFG{colorpal};
sub _($)
{
    map qq'<input type="radio" name="$_[0]" value="$_"'
        . ($_ eq $CoParm{$_[0]} ? ' checked="checked"' : '') .
        qq'><span style="color:$_">■</span> ',
        @colorpal;
}
print
    _ 'ncolor',
    qq'一覧以外(優先色) <input type="text" name="nmycol" size="12" value="$CoParm{nmycol}"><br>文字色\n',
    _ 'tcolor';

とまぁ、こんなもんでしょうか。 どっちにしろ <font> なんか使ってるうちは、まともな HTML が書けませんけど。

if($Tag eq 'on'){
    #ここで禁止タグを設定しています
    $in{'message'} =~ s/\<([\!\-\-].*)>/\<\/b\>\<font size=2\>\(&lt;$1&gt;このタグは使えません\)\<\/font\>\<b\>/g;
    $in{'message'} =~ s/\<([Ff][Oo][Rr][Mm][^>]*)>/\<\/b\>\<font size=2\>\(&lt;$1&gt;このタグは使えません\)\<\/font\>\<b\>/g;
    $in{'message'} =~ s/\<([Tt][Aa][Bb][Ll][Ee][^>]*)>/\<\/b\>\<font size=2\>\(&lt;$1&gt;このタグは使えません\)\<\/font\>\<b\>/g;
    $in{'message'} =~ s/\<([Tt][Rr][^>]*)>/\<\/b\>\<font size=2\>\(&lt;$1&gt;このタグは使えません\)\<\/font\>\<b\>/g;
    $in{'message'} =~ s/\<([Tt][Dd][^>]*)>/\<\/b\>\<font size=2\>\(&lt;$1&gt;このタグは使えません\)\<\/font\>/g;
    $in{'message'} =~ s/\<([Tt][Hh][^>]*)>/\<\/b\>\<font size=2\>\(&lt;$1&gt;このタグは使えません\)\<\/font\>\<b\>/g;
    $in{'message'} =~ s/\<([Pp][Ll][Aa][Ii][Nn][^>]*)>/\<\/b\>\<font size=2\>\(&lt;$1&gt;このタグは使えません\)\<\/font\>\<b\>/g;
    $in{'message'} =~ s/\<([Ss][Cc][Rr][Ii][Pp][Tt][^>]*)\>/\<\/b\>\<font size=2\>\(&lt;$1&gt;このタグは使えません\)\<\/font\>\<b\>/g;
    $in{'message'} =~ s/\<([Mm][Ee][Tt][Aa][^>]*)\>/\<\/b\>\<font size=2\>\(&lt;$1&gt;このタグは使えません\)\<\/font\>/g;
    $in{'message'} =~ s/\<([Aa][Pp][Pp][Ll][Ee][Tt][^>]*)\>/\<\/b\>\<font size=2\>\(&lt;$1&gt;このタグは使えません\)\<\/font\>\<b\>/g;
    $in{'message'} =~ s/\<([Pp][Rr][Ee][^>]*)\>/\<\/b\>\<font size=2\>\(&lt;$1&gt;このタグは使えません\)\<\/font\>\<b\>/g;
    $in{'message'} =~ s/\<([Ii][Nn][Pp][Uu][Tt][^>]*)\>/\<\/b\>\<font size=2\>\(&lt;$1&gt;このタグは使えません\)\<\/font\>\<b\>/g;
}
else{
    $in{'message'} =~ s/</&lt;/g;
    $in{'message'} =~ s/>/&gt;/g;
}

Ignore Case は i Option を使うにしても……。

置き換え後の文字列は全部同じだし……。

先ず、文字クラス内で SGML Comment Marker を指定するのは、無意味且つ (知らない|調べて無い) 証拠ですね。 ちゃんと調べれば /(<!--|--\s*>)/ みたいな記述になったか、 或いはもっと真面目に Parse した筈です。

それと、アングルブラケットを Escape してる時点でちょっと可笑しい訳ですが、 Perlre で Support されてしまったら意図しない動作になるでしょうね (通常 {begin,end} of a word に match します)。

置き換え文字列の丸括弧は Escape 不要ですね。

($Tag eq 'on')
    ? ($in{message} =~ s#<(/?(?:!--|form|table|tr|td|th|plaintext|script|meta|applet|pre|input))\b[^>]*>#&lt;$1&gt;#gi)
    : ($in{message} =~ s/([<>])/'&' . {qw{ < lt > gt }}->{$1} . ';'/eg);

抑々“禁止タグを設定”している時点で危険なんですけど。“許可したタグ”のみ通す可きですね。

$IN{'key1'} =~ s/\ |\ //g;
$IN{'key2'} =~ s/\ |\ //g;
$IN{'key3'} =~ s/\ |\ //g;
$IN{'key4'} =~ s/\ |\ //g;
$IN{'key5'} =~ s/\ |\ //g;
$IN{'key6'} =~ s/\ |\ //g;
$IN{'key7'} =~ s/\ |\ //g;
$IN{'key8'} =~ s/\ |\ //g;
$IN{'key9'} =~ s/\ |\ //g;
$IN{'key10'} =~ s/\ |\ //g;

私の環境(CotEditor.app)では“ ”は全部見えるてゐるのですが、所謂“半角 Space”と“全角 Space”を空文字列に置き換えてゐる積もりの様です。

Shift JIS の“ ”は x8140 ですから 2 Byte 目が“@”なのに 1 Byte 目を Escape してますね。 それも 10 回に分けて。

encoding Pragma が使えない環境なら置き換えないが安全なのではないかと思います。というか置き換える可きで無いが正解か。

s/^(\s|\Q \E)+//gm;

の様に行頭丈け削除する場合に関しては、問題無いのですが。 それでも、どうしてもという場合は連続した場合丈け削除するとか……

for (1 .. 10)
{
    $IN{'key' . $_} =~ tr/ //d;
    $IN{'key' . $_} =~ s/(?<=\x40)(\x81\x40)+//g; # Shift JIS
}

でしょうか。

if($IN{'disp'} == 1){
    $Disp = 1;
}
else{
    $Disp = 0;
}

$Disp が必要なのは単に真偽値なので

$Disp = $IN{disp} == 1;

で良いでしょう。

if($IN{'fc'} eq 'red'){
    $Fc = 'red';
}
elsif($IN{'fc'} eq 'brown'){
    $Fc = 'brown';
}
elsif($IN{'fc'} eq 'green'){
    $Fc = 'green';
}
elsif($IN{'fc'} eq 'lime'){
    $Fc = 'lime';
}
elsif($IN{'fc'} eq 'blue'){
    $Fc = 'blue';
}
elsif($IN{'fc'} eq 'aqua'){
    $Fc = 'aqua';
}
elsif($IN{'fc'} eq 'silver'){
    $Fc = 'silver';
}
elsif($IN{'fc'} eq 'black'){
    $Fc = 'black';
}
else{
    $Fc = 'green';
}

$Fc$IN{fc} と同じに設定するだけなので

$Fc = $IN{fc} || 'green';

で済みますね。

@fctbl

@fctbl = @{{
    red    => [qw/255,160,160 255,128,128 255,160,160     255,0,0     224,0,0     224,0,0     192,0,0  128,0,0/],
    brown  => [qw/255,144,144   192,96,96 241,128,128     176,0,0     160,0,0     160,0,0     128,0,0   96,0,0/],
    green  => [qw/196,224,196     0,192,0     0,192,0     0,128,0     0,128,0     0,128,0      0,96,0   0,64,0/],
    lime   => [qw/224,255,224 128,255,128     0,224,0     0,255,0     0,224,0     0,224,0     0,255,0  0,160,0/],
    blue   => [qw/208,208,255 108,108,255     0,0,255     0,0,255     0,0,224     0,0,224     0,0,192  0,0,128/],
    aqua   => [qw/244,255,255 192,241,241 192,233,233 136,200,200 128,192,192 128,192,192  96,128,128 64,96,96/],
    silver => [qw/224,224,224 216,216,216 208,208,208 192,192,192 192,192,192 192,192,192 128,128,128 96,96,96/],
    black  => [qw/192,192,192 128,128,128 128,128,128       0,0,0       0,0,0       0,0,0    32,32,32 80,80,80/],
}->{$Fc}};

ですな。まぁ、どれもやってる事は単純な訳で、書き方でどんどん長くなってしまっただけの様で。

で、まだある

$Countlen[3] = $Countlen[2];
$Countlen[2] = 1;

これは

@Countlen[3,2] = ($Countlen[2], 1);

ですな。分けて書いた方が分かりにくい。では次。

@w1 = split(//,$Count);
@w2 = split(//,$Countlen[2]);
@w3 = split(//,$Countlen[3]);
$ww1 = $#w1 + 1; $ww2 = $#w2 + 1; $ww3 = $#w3 + 1;
$Imgwidth = ($ww1*$Width)+($ww2*$Width)+($ww3*$Width) + ($F_width * 2) + ($Simgw * 2);
$Imgheight = $Height +  ($F_width * 2);

これは分かりにくい。

($Imgwidth, $Imgheight) = (
    $Width   * length $Count +
    $Width   * length $Countlen[2] +
    $Width   * length $Countlen[3] +
    $F_width * 2 +
    $Simgw   * 2,
    $F_width * 2 + $Height
);

こんなところか。 もういっちょ

sub Frame{
    $w_r1 = $Imgwidth;
    $w_r2 = $Imgwidth -1;
    $w_r3 = $Imgwidth -2;
    $w_r4 = $Imgwidth -3;
    $w_r5 = $Imgwidth -4;
    $w_r11 = $Imgwidth -1;
    $w_r12 = $Imgwidth -2;
    $w_r13 = $Imgwidth -3;
    $w_r14 = $Imgwidth -4;
    $w_r15 = $Imgwidth -5;
    $h_r1 = $Imgheight - 1;
    $h_r2 = $Imgheight - 2;
    $h_r3 = $Imgheight - 3;
    $h_r4 = $Imgheight - 4;
    $h_r5 = $Imgheight - 5;
    print FLY "line 0,0,$w_r1,0,$fctbl[0]\n";
    print FLY "line 1,1,$w_r2,1,$fctbl[3]\n";
    print FLY "line 2,2,$w_r3,2,$fctbl[3]\n";
    print FLY "line 3,3,$w_r4,3,$fctbl[6]\n";
    print FLY "line 4,4,$w_r5,4,$fctbl[7]\n";
    print FLY "line 0,0,0,$h_r1,$fctbl[0]\n";
    print FLY "line 1,1,1,$h_r2,$fctbl[3]\n";
    print FLY "line 2,2,2,$h_r3,$fctbl[3]\n";
    print FLY "line 3,3,3,$h_r4,$fctbl[6]\n";
    print FLY "line 4,4,4,$h_r5,$fctbl[7]\n";
    print FLY "line $w_r11,0,$w_r11,$h_r1,$fctbl[7]\n";
    print FLY "line $w_r12,1,$w_r12,$h_r2,$fctbl[4]\n";
    print FLY "line $w_r13,2,$w_r13,$h_r3,$fctbl[4]\n";
    print FLY "line $w_r14,3,$w_r14,$h_r4,$fctbl[2]\n";
    print FLY "line $w_r15,4,$w_r15,$h_r5,$fctbl[0]\n";
    print FLY "line 0,$h_r1,$w_r11,$h_r1,$fctbl[7]\n";
    print FLY "line 1,$h_r2,$w_r12,$h_r2,$fctbl[5]\n";
    print FLY "line 2,$h_r3,$w_r13,$h_r3,$fctbl[5]\n";
    print FLY "line 3,$h_r4,$w_r14,$h_r4,$fctbl[1]\n";
    print FLY "line 4,$h_r5,$w_r15,$h_r5,$fctbl[0]\n";
}

力作ですね。使い捨ての Scalar 変数を幾つも作ってゐますがよく見れば要らんのが分かるでしょうに。

sub Frame
{
    my ($h, $w) = ($Imgheight - 1, $Imgwidth - 1);
    print FLY map join(',', 'line ' .      $_,      $_, $w - $_ + 1,  $_, $fctbl[(0, 3, 3, 6, 7)[$_]] . "\n"), 0 .. 4;
    print FLY map join(',', 'line ' .      $_,      $_,      $_, $h - $_, $fctbl[(0, 3, 3, 6, 7)[$_]] . "\n"), 0 .. 4;
    print FLY map join(',', 'line ' . $w - $_,      $_, $w - $_, $h - $_, $fctbl[(7, 4, 4, 2, 0)[$_]] . "\n"), 0 .. 4;
    print FLY map join(',', 'line ' .      $_, $h - $_, $w - $_, $h - $_, $fctbl[(7, 5, 5, 1, 0)[$_]] . "\n"), 0 .. 4;
}

もっと出来そうですけど、こんなんで。 意味不明な(?)変数名の付け方(略し方)による読みにくさがちと辛かった。

こんなんもありますね。

open (TXT,$Opentxt);
while (<TXT>){ $text .= $_; }
close (TXT);

意味は

$text = join '', <TXT>;

と同じですけど、Memory の無駄遣いした挙げ句、結局 print するだけなんですね。

print while <TXT>;

にするとかして、しなくていい事はしないようにしましょうね。 というか、 File Open に失敗すると何も表示されないでしょうね。

$man1 = "$image_dir/man1.gif";
$man2 = "$image_dir/man2.gif";
$man3 = "$image_dir/man3.gif";
$man4 = "$image_dir/man4.gif";
$man5 = "$image_dir/man5.gif";
$man6 = "$image_dir/man6.gif";
$man7 = "$image_dir/man7.gif";
$man8 = "$image_dir/man8.gif";
$man9 = "$image_dir/man9.gif";
$bird = "$image_dir/bird.gif";
$sou2 = "$image_dir/sou2.gif";
$sou3 = "$image_dir/sou3.gif";
$sou4 = "$image_dir/sou4.gif";
$sou5 = "$image_dir/sou5.gif";
$sou6 = "$image_dir/sou6.gif";
$sou7 = "$image_dir/sou7.gif";
$sou8 = "$image_dir/sou8.gif";
$sou9 = "$image_dir/sou9.gif";
$pin1 = "$image_dir/pin1.gif";
$pin2 = "$image_dir/pin2.gif";
$pin3 = "$image_dir/pin3.gif";
$pin4 = "$image_dir/pin4.gif";
$pin5 = "$image_dir/pin5.gif";
$pin6 = "$image_dir/pin6.gif";
$pin7 = "$image_dir/pin7.gif";
$pin8 = "$image_dir/pin8.gif";
$pin9 = "$image_dir/pin9.gif";
$haku = "$image_dir/haku.gif";
$hatu = "$image_dir/hatsu.gif";
$chun = "$image_dir/chun.gif";
$ton  = "$image_dir/ton.gif";
$nan  = "$image_dir/nan.gif";
$sha  = "$image_dir/sha.gif";
$pei  = "$image_dir/pei.gif";
for my $f (qw/man sou pin/)
{
    for my $n (1 .. 9)
    {
        $_ = $f . $n eq 'sou1' ? 'bird' : $f . $n;
        $$_ = $image_dir . '/' . $_ . '.gif';
    }
}
for (qw/ton nan sha pei haku hatu chun/)
{
    $$_ = $image_dir . '/' . ($_ eq 'hatu' ? 'hatsu' : $_) . '.gif';
}

全く何の亊やら解りません。全編此の調子。勿論 print は毎行頭に必ず插入されてます。

# ----------------------------------------------
#  引数データの日本語化
&jcode'convert(*name, "$lang");
&jcode'convert(*email, "$lang");
&jcode'convert(*url, "$lang");
&jcode'convert(*content, "$lang");
&jcode'convert(*comment, "$lang");
&jcode'convert(*pass, "$lang");
# ----------------------------------------------
#  引数データの前処理
#  データ保存方式による変換
$name   =~ s/\,/\0/g;   #半角カンマをNULL codeに変換。
$email  =~ s/\,/\0/g;   #半角カンマをNULL codeに変換。
$url    =~ s/\,/\0/g;   #半角カンマをNULL codeに変換。
$content=~ s/\,/\0/g;   #半角カンマをNULL codeに変換。
$comment=~ s/\,/\0/g;   #半角カンマをNULL codeに変換。
$pass   =~ s/\,/\0/g;   #半角カンマをNULL codeに変換。
$name   =~ s/\://g; #半角カンマをNULL codeに変換。
$email  =~ s/\://g; #半角カンマをNULL codeに変換。
for (qw/name email url content comment pass/) {
    jcode::convert(\$_, $lang, '', 'z');
    $$_ =~ tr/,/\0/; # comma を NULL code に変換。
    $$_ =~ tr/:/\0/ if /name|email/; # colon も NULL code に変換したら混乱しない?
}

何か凄く Loop が嫌いな人みたい。

$comment=~ s/&/&amp;/g;
$comment=~ s/</&lt;/g;
$comment=~ s/>/&gt;/g;
$comment=~ s/\n//g;
$comment=~ s/\\m1;/<IMG SRC="$man1" WIDTH="24" HEIGHT="32" ALT="一萬">/g;
$comment=~ s/\\m2;/<IMG SRC="$man2" WIDTH="24" HEIGHT="32" ALT="二萬">/g;
$comment=~ s/\\m3;/<IMG SRC="$man3" WIDTH="24" HEIGHT="32" ALT="三萬">/g;
$comment=~ s/\\m4;/<IMG SRC="$man4" WIDTH="24" HEIGHT="32" ALT="四萬">/g;
$comment=~ s/\\m5;/<IMG SRC="$man5" WIDTH="24" HEIGHT="32" ALT="五萬">/g;
$comment=~ s/\\m6;/<IMG SRC="$man6" WIDTH="24" HEIGHT="32" ALT="六萬">/g;
$comment=~ s/\\m7;/<IMG SRC="$man7" WIDTH="24" HEIGHT="32" ALT="一萬">/g;
$comment=~ s/\\m8;/<IMG SRC="$man8" WIDTH="24" HEIGHT="32" ALT="一萬">/g;
$comment=~ s/\\m9;/<IMG SRC="$man9" WIDTH="24" HEIGHT="32" ALT="一萬">/g;
$comment=~ s/\\s1;/<IMG SRC="$bird" WIDTH="24" HEIGHT="32" ALT="一索">/g;
$comment=~ s/\\s2;/<IMG SRC="$sou2" WIDTH="24" HEIGHT="32" ALT="一索">/g;
$comment=~ s/\\s3;/<IMG SRC="$sou3" WIDTH="24" HEIGHT="32" ALT="一索">/g;
$comment=~ s/\\s4;/<IMG SRC="$sou4" WIDTH="24" HEIGHT="32" ALT="一索">/g;
$comment=~ s/\\s5;/<IMG SRC="$sou5" WIDTH="24" HEIGHT="32" ALT="一索">/g;
$comment=~ s/\\s6;/<IMG SRC="$sou6" WIDTH="24" HEIGHT="32" ALT="一索">/g;
$comment=~ s/\\s7;/<IMG SRC="$sou7" WIDTH="24" HEIGHT="32" ALT="一索">/g;
$comment=~ s/\\s8;/<IMG SRC="$sou8" WIDTH="24" HEIGHT="32" ALT="一索">/g;
$comment=~ s/\\s9;/<IMG SRC="$sou9" WIDTH="24" HEIGHT="32" ALT="一索">/g;
$comment=~ s/\\p1;/<IMG SRC="$pin1" WIDTH="24" HEIGHT="32" ALT="一筒">/g;
$comment=~ s/\\p2;/<IMG SRC="$pin2" WIDTH="24" HEIGHT="32" ALT="一筒">/g;
$comment=~ s/\\p3;/<IMG SRC="$pin3" WIDTH="24" HEIGHT="32" ALT="一筒">/g;
$comment=~ s/\\p4;/<IMG SRC="$pin4" WIDTH="24" HEIGHT="32" ALT="一筒">/g;
$comment=~ s/\\p5;/<IMG SRC="$pin5" WIDTH="24" HEIGHT="32" ALT="一筒">/g;
$comment=~ s/\\p6;/<IMG SRC="$pin6" WIDTH="24" HEIGHT="32" ALT="一筒">/g;
$comment=~ s/\\p7;/<IMG SRC="$pin7" WIDTH="24" HEIGHT="32" ALT="一筒">/g;
$comment=~ s/\\p8;/<IMG SRC="$pin8" WIDTH="24" HEIGHT="32" ALT="一筒">/g;
$comment=~ s/\\p9;/<IMG SRC="$pin9" WIDTH="24" HEIGHT="32" ALT="一筒">/g;
$comment=~ s/\\haku;/<IMG SRC="$haku" WIDTH="24" HEIGHT="32" ALT="白">/g;
$comment=~ s/\\hatu;/<IMG SRC="$hatu" WIDTH="24" HEIGHT="32" ALT="發">/g;
$comment=~ s/\\chun;/<IMG SRC="$chun" WIDTH="24" HEIGHT="32" ALT="中">/g;
$comment=~ s/\\ton;/<IMG SRC="$ton" WIDTH="24" HEIGHT="32" ALT="東">/g;
$comment=~ s/\\nan;/<IMG SRC="$nan" WIDTH="24" HEIGHT="32" ALT="南">/g;
$comment=~ s/\\sha;/<IMG SRC="$sha" WIDTH="24" HEIGHT="32" ALT="西">/g;
$comment=~ s/\\pei;/<IMG SRC="$pei" WIDTH="24" HEIGHT="32" ALT="北">/g;
$comment= "$comment<!--REMOTE_HOST:$ENV{'REMOTE_HOST'}-->";
$comment= "$comment<!--REMOTE_ADDR:$ENV{'REMOTE_ADDR'}-->";

一応書き換えてみますが、此んな程度では無意味です。ていうか「六萬」以降は全部「一」。流石に面倒臭かったんだろうょ(w

$comment =~ tr/\n//d;
$comment =~ s/([&<>"])/'&' . {qw(& amp < lt > gt " quot)}->{$1} . ';'/eg;
@_ = qw(〇 一 二 三 四 五 六 七 八 九);
for (1 .. 9)
{
    $comment =~ s#\\([msp])$_;# qq'<img src="$image_dir/' . {qw(m man s sou p pin)}->{$1} .
        $_ . '.gif" width="24" height="32" alt="' . $_[$_] . {qw(m 萬 s 索 p 筒)}->{$1} . '">' #eg;
}
%_ = qw(ton 東 nan 南 sha 西 pei 北 haku 白 hatu 發 chun 中);
for (keys %_)
{
    $comment =~ s#\\$_;#<img src="$image_dir/$_.gif" width="24" height="32" alt="$_{$_}">#g;
}
$comment .= "<!--REMOTE_HOST:$ENV{REMOTE_HOST};REMOTE_ADDR:$ENV{REMOTE_ADDR}-->";
$name   =~ s/\0/\,/g;   #NULL codeを半角カンマに復帰。
$email  =~ s/\0/\,/g;   #NULL codeを半角カンマに復帰。
$url    =~ s/\0/\,/g;   #NULL codeを半角カンマに復帰。
$content=~ s/\0/\,/g;   #NULL codeを半角カンマに復帰。
$comment=~ s/\0/\,/g;   #NULL codeを半角カンマに復帰。
$pass   =~ s/\0/\,/g;   #NULL codeを半角カンマに復帰。
for (qw/name email url content comment pass/) {
    $$_ =~ tr/\0/,/; # NULL code を comma に復帰。
}
$del_date   = $chk_date;
$del_name   = $chk_name;
$del_email  = $chk_email;
$del_icq    = $chk_icq;
$del_url    = $chk_url;
$del_content    = $chk_content;
$del_comment    = $chk_comment;
$del_comment=~ s/<IMG SRC="$man1" WIDTH="24" HEIGHT="32" ALT="一萬">/\\m1;/g;
$del_comment=~ s/<IMG SRC="$man2" WIDTH="24" HEIGHT="32" ALT="二萬">/\\m2;/g;
$del_comment=~ s/<IMG SRC="$man3" WIDTH="24" HEIGHT="32" ALT="三萬">/\\m3;/g;
$del_comment=~ s/<IMG SRC="$man4" WIDTH="24" HEIGHT="32" ALT="四萬">/\\m4;/g;
$del_comment=~ s/<IMG SRC="$man5" WIDTH="24" HEIGHT="32" ALT="五萬">/\\m5;/g;
$del_comment=~ s/<IMG SRC="$man6" WIDTH="24" HEIGHT="32" ALT="六萬">/\\m6;/g;
$del_comment=~ s/<IMG SRC="$man7" WIDTH="24" HEIGHT="32" ALT="一萬">/\\m7;/g;
$del_comment=~ s/<IMG SRC="$man8" WIDTH="24" HEIGHT="32" ALT="一萬">/\\m8;/g;
$del_comment=~ s/<IMG SRC="$man9" WIDTH="24" HEIGHT="32" ALT="一萬">/\\m9;/g;
$del_comment=~ s/<IMG SRC="$bird" WIDTH="24" HEIGHT="32" ALT="一索">/\\s1;/g;
$del_comment=~ s/<IMG SRC="$sou2" WIDTH="24" HEIGHT="32" ALT="一索">/\\s2;/g;
$del_comment=~ s/<IMG SRC="$sou3" WIDTH="24" HEIGHT="32" ALT="一索">/\\s3;/g;
$del_comment=~ s/<IMG SRC="$sou4" WIDTH="24" HEIGHT="32" ALT="一索">/\\s4;/g;
$del_comment=~ s/<IMG SRC="$sou5" WIDTH="24" HEIGHT="32" ALT="一索">/\\s5;/g;
$del_comment=~ s/<IMG SRC="$sou6" WIDTH="24" HEIGHT="32" ALT="一索">/\\s6;/g;
$del_comment=~ s/<IMG SRC="$sou7" WIDTH="24" HEIGHT="32" ALT="一索">/\\s7;/g;
$del_comment=~ s/<IMG SRC="$sou8" WIDTH="24" HEIGHT="32" ALT="一索">/\\s8;/g;
$del_comment=~ s/<IMG SRC="$sou9" WIDTH="24" HEIGHT="32" ALT="一索">/\\s9;/g;
$del_comment=~ s/<IMG SRC="$pin1" WIDTH="24" HEIGHT="32" ALT="一筒">/\\p1;/g;
$del_comment=~ s/<IMG SRC="$pin2" WIDTH="24" HEIGHT="32" ALT="一筒">/\\p2;/g;
$del_comment=~ s/<IMG SRC="$pin3" WIDTH="24" HEIGHT="32" ALT="一筒">/\\p3;/g;
$del_comment=~ s/<IMG SRC="$pin4" WIDTH="24" HEIGHT="32" ALT="一筒">/\\p4;/g;
$del_comment=~ s/<IMG SRC="$pin5" WIDTH="24" HEIGHT="32" ALT="一筒">/\\p5;/g;
$del_comment=~ s/<IMG SRC="$pin6" WIDTH="24" HEIGHT="32" ALT="一筒">/\\p6;/g;
$del_comment=~ s/<IMG SRC="$pin7" WIDTH="24" HEIGHT="32" ALT="一筒">/\\p7;/g;
$del_comment=~ s/<IMG SRC="$pin8" WIDTH="24" HEIGHT="32" ALT="一筒">/\\p8;/g;
$del_comment=~ s/<IMG SRC="$pin9" WIDTH="24" HEIGHT="32" ALT="一筒">/\\p9;/g;
$del_comment=~ s/<IMG SRC="$haku" WIDTH="24" HEIGHT="32" ALT="白">/\\haku;/g;
$del_comment=~ s/<IMG SRC="$hatu" WIDTH="24" HEIGHT="32" ALT="發">/\\hatu;/g;
$del_comment=~ s/<IMG SRC="$chun" WIDTH="24" HEIGHT="32" ALT="中">/\\chun;/g;
$del_comment=~ s/<IMG SRC="$ton" WIDTH="24" HEIGHT="32" ALT="東">/\\ton;/g;
$del_comment=~ s/<IMG SRC="$nan" WIDTH="24" HEIGHT="32" ALT="南">/\\nan;/g;
$del_comment=~ s/<IMG SRC="$sha" WIDTH="24" HEIGHT="32" ALT="西">/\\sha;/g;
$del_comment=~ s/<IMG SRC="$pei" WIDTH="24" HEIGHT="32" ALT="北">/\\pei;/g;
$res_date   = $chk_date;
$res_name   = $chk_name;
$res_email  = $chk_email;
$res_icq    = $chk_icq;
$res_url    = $chk_url;
$res_content    = $chk_content;
$res_comment    = $chk_comment;
$res_comment=~ s/<!--.*>//g;
$res_comment=~ s/<IMG SRC="$man1" WIDTH="24" HEIGHT="32" ALT="一萬">/\\m1;/g;
$res_comment=~ s/<IMG SRC="$man2" WIDTH="24" HEIGHT="32" ALT="二萬">/\\m2;/g;
$res_comment=~ s/<IMG SRC="$man3" WIDTH="24" HEIGHT="32" ALT="三萬">/\\m3;/g;
$res_comment=~ s/<IMG SRC="$man4" WIDTH="24" HEIGHT="32" ALT="四萬">/\\m4;/g;
$res_comment=~ s/<IMG SRC="$man5" WIDTH="24" HEIGHT="32" ALT="五萬">/\\m5;/g;
$res_comment=~ s/<IMG SRC="$man6" WIDTH="24" HEIGHT="32" ALT="六萬">/\\m6;/g;
$res_comment=~ s/<IMG SRC="$man7" WIDTH="24" HEIGHT="32" ALT="一萬">/\\m7;/g;
$res_comment=~ s/<IMG SRC="$man8" WIDTH="24" HEIGHT="32" ALT="一萬">/\\m8;/g;
$res_comment=~ s/<IMG SRC="$man9" WIDTH="24" HEIGHT="32" ALT="一萬">/\\m9;/g;
$res_comment=~ s/<IMG SRC="$bird" WIDTH="24" HEIGHT="32" ALT="一索">/\\s1;/g;
$res_comment=~ s/<IMG SRC="$sou2" WIDTH="24" HEIGHT="32" ALT="一索">/\\s2;/g;
$res_comment=~ s/<IMG SRC="$sou3" WIDTH="24" HEIGHT="32" ALT="一索">/\\s3;/g;
$res_comment=~ s/<IMG SRC="$sou4" WIDTH="24" HEIGHT="32" ALT="一索">/\\s4;/g;
$res_comment=~ s/<IMG SRC="$sou5" WIDTH="24" HEIGHT="32" ALT="一索">/\\s5;/g;
$res_comment=~ s/<IMG SRC="$sou6" WIDTH="24" HEIGHT="32" ALT="一索">/\\s6;/g;
$res_comment=~ s/<IMG SRC="$sou7" WIDTH="24" HEIGHT="32" ALT="一索">/\\s7;/g;
$res_comment=~ s/<IMG SRC="$sou8" WIDTH="24" HEIGHT="32" ALT="一索">/\\s8;/g;
$res_comment=~ s/<IMG SRC="$sou9" WIDTH="24" HEIGHT="32" ALT="一索">/\\s9;/g;
$res_comment=~ s/<IMG SRC="$pin1" WIDTH="24" HEIGHT="32" ALT="一筒">/\\p1;/g;
$res_comment=~ s/<IMG SRC="$pin2" WIDTH="24" HEIGHT="32" ALT="一筒">/\\p2;/g;
$res_comment=~ s/<IMG SRC="$pin3" WIDTH="24" HEIGHT="32" ALT="一筒">/\\p3;/g;
$res_comment=~ s/<IMG SRC="$pin4" WIDTH="24" HEIGHT="32" ALT="一筒">/\\p4;/g;
$res_comment=~ s/<IMG SRC="$pin5" WIDTH="24" HEIGHT="32" ALT="一筒">/\\p5;/g;
$res_comment=~ s/<IMG SRC="$pin6" WIDTH="24" HEIGHT="32" ALT="一筒">/\\p6;/g;
$res_comment=~ s/<IMG SRC="$pin7" WIDTH="24" HEIGHT="32" ALT="一筒">/\\p7;/g;
$res_comment=~ s/<IMG SRC="$pin8" WIDTH="24" HEIGHT="32" ALT="一筒">/\\p8;/g;
$res_comment=~ s/<IMG SRC="$pin9" WIDTH="24" HEIGHT="32" ALT="一筒">/\\p9;/g;
$res_comment=~ s/<IMG SRC="$haku" WIDTH="24" HEIGHT="32" ALT="白">/\\haku;/g;
$res_comment=~ s/<IMG SRC="$hatu" WIDTH="24" HEIGHT="32" ALT="發">/\\hatu;/g;
$res_comment=~ s/<IMG SRC="$chun" WIDTH="24" HEIGHT="32" ALT="中">/\\chun;/g;
$res_comment=~ s/<IMG SRC="$ton" WIDTH="24" HEIGHT="32" ALT="東">/\\ton;/g;
$res_comment=~ s/<IMG SRC="$nan" WIDTH="24" HEIGHT="32" ALT="南">/\\nan;/g;
$res_comment=~ s/<IMG SRC="$sha" WIDTH="24" HEIGHT="32" ALT="西">/\\sha;/g;
$res_comment=~ s/<IMG SRC="$pei" WIDTH="24" HEIGHT="32" ALT="北">/\\pei;/g;

略同じなので一つに纏めてしまえ。

for (qw/date name email icq url content comment/)
{
    ${"res_$_"} = ${"del_$_"} = ${"chk_$_"};
}
sub _($)
{
    @_ = qw(〇 一 二 三 四 五 六 七 八 九);
    for (1 .. 9)
    {
        $_[0] =~ s#<img src="$image_dir/(?:(m)an|(s)ou|(p)in)$_.gif" width="24" height="32" alt="$_[$_](?:萬|索|筒)">#\\$+$_;#g;
    }
    %_ = qw(ton 東 nan 南 sha 西 pei 北 haku 白 hatu 發 chun 中);
    for (keys %_)
    {
        $_[0] =~ s#<img src="$image_dir/$_.gif" width="24" height="32" alt="$_{$_}">#\\$_;#g;
    }
}
$res_comment =~ s/<!--.*--\s*>//g;
_ $del_comment;
_ $res_comment;

$chk_* とか $del_* とか $res_* とか、なんで Hash にしないのかな。

sub tag {
if($FORM{'comment'} =~ /(<center|<\/center|<bg)/i){&del_tag;}
if($FORM{'comment'} =~ /<iframe/i){&del_tag;}
if($FORM{'comment'} =~ /<object/i){&del_tag;}
if($FORM{'comment'} =~ /<s>/i){&del_tag;}
if($FORM{'comment'} =~ /<applet/i){&del_tag;}
if($FORM{'comment'} =~ /<xmp/i){&del_tag;}
if($FORM{'comment'} =~ /<plaintext/i){&del_tag;}
if($FORM{'comment'} =~ /<meta/i){&del_tag;}
if($FORM{'comment'} =~ /<script/i){&del_tag;}
if($FORM{'comment'} =~ /<!.*/i){&del_tag;}
if($FORM{'comment'} =~ /(<body|<\/body)/i){&del_tag;}
if($FORM{'comment'} =~ /(<head|<\/head)/i){&del_tag;}
if($FORM{'comment'} =~ /(<html|<\/html)/i){&del_tag;}
if($FORM{'comment'} =~ /(<form|<\/form)/i){&del_tag;}
if($FORM{'comment'} =~ /(<pre|<\/pre)/i){&del_tag;}
if($FORM{'comment'} =~ /(<table|<\/table)/i){&del_tag;}
if($img == 2){
$FORM{'comment'} =~ s/(<img|<.*src)//ig;
}
$FORM{'comment'} =~ s/<a href/<a target="_top" href/ig;
if($FORM{'comment'} =~ /<a target/i && $FORM{'comment'} !~ /<\/a>/i){
$s = "</a></a>";
}else{$s = "";}
if($FORM{'comment'} =~ /<font.*/i && $FORM{'comment'} !~ /<\/font>/i){
$set = "</font></font>";
}else{$set = "";}
}

こんな風に書こうと思える發想が私には無い。前半部分を此の儘書き直すと

sub tag
{
    &del_tag if $FORM{comment} =~ m#</?(?:!|applet|bgsound|body|center|form|
        head|html|iframe|meta|object|plaintext|pre|s|script|table|xmp)\b#ix;

となるが、「禁止タグ以外は通す」という考へ方は危險なので、「許可タグ以外は禁止に」しないと駄目。 其の上、後半部分でタグの閉じが無い場合に 2 個丈けしか追加しないので 3 個以上だと結局閉じられない。 ロボコン 0 點、バッテンパンチ。

### スイッチ処理
($sw_form)    ? ($fm1 = "CHECKED") : ($fm0 = "CHECKED");
($sw_preview) ? ($pv1 = "CHECKED") : ($pv0 = "CHECKED");
($sw_ppr)     ? ($pp1 = "CHECKED") : ($pp0 = "CHECKED");
($sw_search)  ? ($sc1 = "CHECKED") : ($sc0 = "CHECKED");
($sw_head)    ? ($hd1 = "CHECKED") : ($hd0 = "CHECKED");
($sw_host)    ? ($hs1 = "CHECKED") : ($hs0 = "CHECKED");
($sw_reply)   ? ($rp1 = "CHECKED") : ($rp0 = "CHECKED");
($sw_showdel) ? ($sd1 = "CHECKED") : ($sd0 = "CHECKED");
($sw_anobar)  ? ($an1 = "CHECKED") : ($an0 = "CHECKED");
if($sw_reply == 2){
    $rp1 = "";
    $rp2 = "CHECKED";
}
if($sw_ppr == 2){
    $pp1 = "";
    $pp2 = "CHECKED";
}
if($sw_preview == 2){
    $pv1 = "";
    $pv2 = "CHECKED";
}

それにしてもこれ、數が 5000 に増えたら 5000 行書くつもりなんでしょうか。大變努力家で結構な亊で。

變數名をもっと整理して、代入先も Array にするとかすれば、 だらだら書かなくても済むのに……。

sub _($)
{
    ('', 'checked')[@{([1, 0, 0], [0, 1, 0], [0, 0, 1])[$_[0]]}];
}
%_ = qw{
    an anobar
    fm form
    hd head
    hs host
    pp ppr
    pv preview
    rp reply
    sc search
    sd showdel
};
(${$k . '0'}, ${$k . '1'}, ${$k . '2'}) = _ ${'sw_' . $v} while ($k, $v) = each %_;
@counter = split(//,$data);
$yousosu = @counter;
if($yousosu == 1){@counter = (0,0,0,0,0,@counter);}
elsif($yousosu == 2){@counter = (0,0,0,0,@counter);}
elsif($yousosu == 3){@counter = (0,0,0,@counter);}
elsif($yousosu == 4){@counter = (0,0,@counter);}
elsif($yousosu == 5){@counter = (0,@counter);}
elsif($yousosu > 5){@counter = (@counter);}
if (!open(OU,"$index")) {&error;}
else{
@lines = <OU>;
close(OU);
}
$no_ssi = "<!--Copyright (c) 1996/1997  K.Yamano Counter_NO_SSI  Ver1.1 http://www2a.meshnet.or.jp/~yama/-->";
if($no_ssi !~ /<!--.*op.*/){unlink($lockfile); exit;}
foreach $line (@lines){
       print "$line";
if($line =~ /<!--win-->/){
        print "$no_ssi\n";
for $count (@counter) {
   #下記は、カウンタ−gifまでの相対パスかURLを記入。/$count.gif は削除してはダメです。
    print "<IMG SRC=\"./counter/$count.gif\" ALT=\"$count\">";
    }
  }
}

これはこれは、ご苦労樣でございます。

open _, $index or &error;
print $_, /<!--win-->/ ? ('
<!--Copyright (c) 1996/1997  K.Yamano Counter_NO_SSI  Ver1.1 http://www2a.meshnet.or.jp/~yama/-->
', map qq'<img src="./counter/$_.gif" alt="$_">', split //, sprintf '%06d', $data) : '' while <_>;
close _;

部分的ですが

<input type="hidden" name="c" value="5">
<input type="hidden" name="f1" value="$IN{'f1'}">
<input type="hidden" name="f2" value="$IN{'f2'}">
<input type="hidden" name="n1" value="$IN{'n1'}">
<input type="hidden" name="n2" value="$IN{'n2'}">
<input type="hidden" name="namae" value="$IN{'namae'}">
<input type="hidden" name="kana" value="$IN{'kana'}">
<input type="hidden" name="email" value="$IN{'email'}">
<input type="hidden" name="title" value="$IN{'title'}">
<input type="hidden" name="url" value="$IN{'url'}">
<input type="hidden" name="comment" value="$IN{'comment'}">
<input type="hidden" name="key1" value="$IN{'key1'}">
<input type="hidden" name="key2" value="$IN{'key2'}">
<input type="hidden" name="key3" value="$IN{'key3'}">
<input type="hidden" name="key4" value="$IN{'key4'}">
<input type="hidden" name="key5" value="$IN{'key5'}">
<input type="hidden" name="key6" value="$IN{'key6'}">
<input type="hidden" name="key7" value="$IN{'key7'}">
<input type="hidden" name="key8" value="$IN{'key8'}">
<input type="hidden" name="key9" value="$IN{'key9'}">
<input type="hidden" name="key10" value="$IN{'key10'}">
<input type="hidden" name="password" value="$IN{'password'}">

英会話教室じゃあるまいし。

print '<input type="hidden" name="c" value="5">
', map qq'<input type="hidden" name="$_" value="$IN{$_}">\n', (
    qw{ f1 f2 n1 n2 namae kana email title url comment }, map('key' . $_, 1 .. 10), 'password'
);
if ( $FORM{'action'} eq "maintenance" ) {  &Maintenance; }      #"処理"がメンテナンスの場合
if ( $FORM{'action'} eq "update" ) {  &update; }                #ログ更新処理
if ( $FORM{'action'} eq "regist" ) {  &regist; }                #ログ書き込み処理
if ( $FORM{'action'} eq "link" ) {  &link; }                    #カウント&URLリンク
if ( $FORM{'action'} eq "rank" ) {  &rank; }                    #ランキング表示
if ( $FORM{'action'} eq "input" ) {  &formproc2; }              #投稿フォーム表示
if ( $FORM{'action'} eq "repairup" ) {  &repairup; }            #バックアップ復旧作業

ま、これは何処にでもありそうですが、こういうのって何か無駄に思えないのでしょうか? elsif を使う可きとか云う以前に。 Subroutine 名変えないと使えませんが、私なら一文で書きます。

&{$FORM{action}} if grep $FORM{action} eq $_, qw{
    maintenance  update  regist  link  rank  input  repairup
};
sub lock {
    $retry = 3;
    while (!symlink("lock.dat", $lock)) {
        if (--$retry <= 0) { &error(0); }
        sleep(2);
    }
    $retry = 'lock';
};
sub lock_pwl {
    $retry_pwl = 3;
    while (!symlink("lock.dat", $lock_pwl)) {
        if (--$retry_pwl <= 0) { &error(0); }
        sleep(2);
    }
    $retry_pwl = 'lock';
};

変数名に _pwl が付いてるか否か丈けで他は全く同じ sub.

呼び出し側で lock($retry, $lock); 或いは lock($retry_pwl, $lock_pwl); とする丈けで纏められる。

sub lock
{
    $_[0] = 3;
    while (! symlink 'lock.dat', $_[1])
    {
        $_[0] <= 0 and error(0);
        sleep(2);
    }
    $_[0] = 'lock';
}

lock 処理も色々廻り諄いのが多いみたい。

sub lock1 {
    $list = `ls $ls` || &error("システムエラー1",'');
    if ($list eq '') { &error("システムエラー2",''); }
    @lists = split(/\s+/,$list);
    @lists = grep(/\.tmp/,@lists);
    local($retry) = 3;
    while (@lists) {
        if (--$retry <= 0) {
            foreach (@lists) { if (-e $_) { unlink; }}
            &error("Busy(1)",'ただ今混雑しております.<br>時間をおいて再度実行してください.');
        }
        sleep(1);
        $list = `ls $ls`;
        @lists = split(/\s+/,$list);
        @lists = grep(/\.tmp/,@lists);
    }
}
sub lock2 {
    $list = `ls $ls`;
    @lists = split(/\s+/,$list);
    @lists = grep(/\.tmp/,@lists);
    @lists = grep(!/$tmp_file/,@lists);
    if (@lists) {
        if (-e "$tmp_dir\/$tmp_file") { unlink("$tmp_dir\/$tmp_file"); }
        &error("Busy(2)",'書き込みに失敗しました.<br>再度実行してください.');
    }
    if (!rename("$tmp_dir\/$tmp_file","$tmp_dir\/$file")) { &error("Busy(3)",'書き込みに失敗しました.<br>再度実行してください.'); } ;
    chmod 0666,"$tmp_dir\/$file";
}

なんかどことなくおかしくないかぃ??

sub lock1
{
    my $retry = 3;
    while ($retry-- && @lists = <*.tmp>)
    {
        unlink @lists;
        error('Busy(1)', 'ただ今混雑しております.<br>時間をおいて再度実行してください.');
        sleep(1);
    }
}
sub lock2
{
    if (grep ! /$tmp_file/, <*.tmp>)
    {
        unlink "$tmp_dir/$tmp_file" if -e "$tmp_dir/$tmp_file";
        error('Busy(2)', '書き込みに失敗しました.<br>再度実行してください.');
    }
    elsif (! rename "$tmp_dir/$tmp_file", "$tmp_dir/$file")
    {
        error('Busy(3)', '書き込みに失敗しました.<br>再度実行してください.');
    }
    chmod 0666, "$tmp_dir/$file";
}

あんまり変わらなかったかな???

無駄の応酬。

sub send_cookie
{
    # 3000年1月1日まで有効 笑い
    print 'Set-Cookie: env=',
        join('<>', map join(':', $_, int($FORM{$_} eq 'checked'),
            qw{acte anothere commente crce datee gzipence md5e mimee sizee}),
        "; expires=Wednesday, 1-Jan-3000 00:00:00 GMT\x0D\x0A";
}
($sec, $min, $hour) = localtime(time);
$omikuji = (
    '<IMG SRC="./images/kuji0.gif">',
    '<IMG SRC="./images/kuji1.gif">',
    '<IMG SRC="./images/kuji2.gif">',
    '<IMG SRC="./images/kuji3.gif">',
    '<IMG SRC="./images/kuji4.gif">',
    '<IMG SRC="./images/kuji5.gif">',
    '<IMG SRC="./images/kuji6.gif">'
)[$sec % 7];
print "$omikuji";

なんだかなぁ……、毎秒 Increment するだけだねぇ。CGI にする必要ある?

print '<img src="./images/kuji', ($^T % 7), '.gif">';
$music1 = '<EMBED SRC="bgm1.mid" WIDTH=145 HEIGHT=60 AUTOSTART="true" LOOP="false" CONTROLS="console">';
$music2 = '<EMBED SRC="bgm2.mid" WIDTH=145 HEIGHT=60 AUTOSTART="true" LOOP="false" CONTROLS="console">';
$music3 = '<EMBED SRC="bgm3.mid" WIDTH=145 HEIGHT=60 AUTOSTART="true" LOOP="false" CONTROLS="console">';
$music3 = '<EMBED SRC="bgm4.mid" WIDTH=145 HEIGHT=60 AUTOSTART="true" LOOP="false" CONTROLS="console">';
($sec, $min, $hour) = localtime(time);
if    ($hour <  6) { $music = $music1; } 
elsif ($hour < 12) { $music = $music2; }
elsif ($hour < 18) { $music = $music3; }
else               { $music = $music4; }
print "$music";

またまた……、6 時間毎ですな。

print '<object type="audio/midi" data="bgm', int((localtime)[2] / 6 + 1),
    '.mid" standby="BGM Midi" width="145" height="60"></object>';
($sec, $min, $hour) = localtime(time);
$message = (
    'こんばんは。0時を過ぎました。楽しいページはありましたか。',
    'こんばんは。1時を過ぎました。夜はこれからです。',
    'こんばんは。2時を過ぎました。軽くなってきましたか。',
    'こんばんは。3時を過ぎました。まだ眠らないのですか。',
    'おはようございます。4時を過ぎました。こんな深夜にようこそ。',
    'おはようございます。5時を過ぎました。そろそろ夜が明けますね。',
    'おはようございます。6時を過ぎました。今日の天気は如何ですか。',
    'おはようございます。7時を過ぎました。今日も元気に頑張りましょう。',
    'おはようございます。8時を過ぎました。遅刻に注意してね。',
    'おはようございます。9時を過ぎました。お掃除しましょう。',
    'こんにちは。10時を過ぎました。ひと休みしましょう。',
    'こんにちは。11時を過すぎました。もうすぐお昼です。',
    'こんにちは。12時を過ぎました。今日のお昼は何かな。',
    'こんにちは。1時を過ぎました。お昼寝の時間です。',
    'こんにちは。2時を過ぎました。ワイドショーの時間です。',
    'こんにちは。3時を過ぎました。おやつの時間です。',
    'こんにちは。4時を過ぎました。もうひと頑張りです。',
    'こんにちは。5時を過ぎました。お疲れさまでした。',
    'こんばんは。6時を過ぎました。ニュースの時間です。',
    'こんばんは。7時を過ぎました。晩御飯は何ですか。',
    'こんばんは。8時を過ぎました。面白い番組はありましたか。',
    'こんばんは。9時を過ぎました。ドラマの時間です。',
    'こんばんは。10時を過ぎました。もうお風呂は入りましたか。',
    'こんばんは。11時を過ぎました。テレホーダイ開始です。'
)[$hour];
print "$message";

ちょっと飽きてきたし……。

$_ = (localtime)[2];
print +(qw/
        こんばんは。
        おはようございます。
        こんにちは。
        こんばんは。
    /)[ ($_ + 3) / 7 ],
    $_, '時を過ぎました。',
    (qw/
        楽しいページはありましたか。
        夜はこれからです。
        軽くなってきましたか。
        まだ眠らないのですか。
        こんな深夜にようこそ。
        そろそろ夜が明けますね。
        今日の天気は如何ですか。
        今日も元気に頑張りましょう。
        遅刻に注意してね。
        お掃除しましょう。
        ひと休みしましょう。
        もうすぐお昼です。
        今日のお昼は何かな。
        お昼寝の時間です。
        ワイドショーの時間です。
        おやつの時間です。
        もうひと頑張りです。
        お疲れさまでした。
        ニュースの時間です。
        晩御飯は何ですか。
        面白い番組はありましたか。
        ドラマの時間です。
        もうお風呂は入りましたか。
        テレホーダイ開始です。
    /)[$_];

余りにもあんまりなのを見付けてしまったので CGI ではないのに掲載。

$(function(){
$('.program2').hover(function(){ $(this).addClass('hover'); },function(){ $(this).removeClass('hover'); });
$('.program_3').hover(function(){ $(this).addClass('hover'); },function(){ $(this).removeClass('hover'); });
$('.program_4').hover(function(){ $(this).addClass('hover'); },function(){ $(this).removeClass('hover'); });
$('.program_5').hover(function(){ $(this).addClass('hover'); },function(){ $(this).removeClass('hover'); });
$('.program_6').hover(function(){ $(this).addClass('hover'); },function(){ $(this).removeClass('hover'); });
$('.program_7').hover(function(){ $(this).addClass('hover'); },function(){ $(this).removeClass('hover'); });
$('.program_8').hover(function(){ $(this).addClass('hover'); },function(){ $(this).removeClass('hover'); });
$('.program_9').hover(function(){ $(this).addClass('hover'); },function(){ $(this).removeClass('hover'); });
$('.program_10').hover(function(){ $(this).addClass('hover'); },function(){ $(this).removeClass('hover'); });
$('.program_11').hover(function(){ $(this).addClass('hover'); },function(){ $(this).removeClass('hover'); });
$('.program_12').hover(function(){ $(this).addClass('hover'); },function(){ $(this).removeClass('hover'); });
$('.program_13').hover(function(){ $(this).addClass('hover'); },function(){ $(this).removeClass('hover'); });
$('.program_16').hover(function(){ $(this).addClass('hover'); },function(){ $(this).removeClass('hover'); });
$('.program_17').hover(function(){ $(this).addClass('hover'); },function(){ $(this).removeClass('hover'); });
$('.program_18').hover(function(){ $(this).addClass('hover'); },function(){ $(this).removeClass('hover'); });
$('.program_19').hover(function(){ $(this).addClass('hover'); },function(){ $(this).removeClass('hover'); });
$('.program_20').hover(function(){ $(this).addClass('hover'); },function(){ $(this).removeClass('hover'); });
$('.program_21').hover(function(){ $(this).addClass('hover'); },function(){ $(this).removeClass('hover'); });
$('.program_22').hover(function(){ $(this).addClass('hover'); },function(){ $(this).removeClass('hover'); });
$('.program_23').hover(function(){ $(this).addClass('hover'); },function(){ $(this).removeClass('hover'); });
$('.program_24').hover(function(){ $(this).addClass('hover'); },function(){ $(this).removeClass('hover'); });
$('.program_25').hover(function(){ $(this).addClass('hover'); },function(){ $(this).removeClass('hover'); });
$('.program_26').hover(function(){ $(this).addClass('hover'); },function(){ $(this).removeClass('hover'); });
$('.program_27').hover(function(){ $(this).addClass('hover'); },function(){ $(this).removeClass('hover'); });
$('.program_28').hover(function(){ $(this).addClass('hover'); },function(){ $(this).removeClass('hover'); });
$('.program_29').hover(function(){ $(this).addClass('hover'); },function(){ $(this).removeClass('hover'); });
$('.program_30').hover(function(){ $(this).addClass('hover'); },function(){ $(this).removeClass('hover'); });
$('.program_31').hover(function(){ $(this).addClass('hover'); },function(){ $(this).removeClass('hover'); });
$('.program_33').hover(function(){ $(this).addClass('hover'); },function(){ $(this).removeClass('hover'); });
$('.program_34').hover(function(){ $(this).addClass('hover'); },function(){ $(this).removeClass('hover'); });
$('.program_41').hover(function(){ $(this).addClass('hover'); },function(){ $(this).removeClass('hover'); });
$('.program_42').hover(function(){ $(this).addClass('hover'); },function(){ $(this).removeClass('hover'); });
$('.program_43').hover(function(){ $(this).addClass('hover'); },function(){ $(this).removeClass('hover'); });
$('.program_44').hover(function(){ $(this).addClass('hover'); },function(){ $(this).removeClass('hover'); });
$('.program_45').hover(function(){ $(this).addClass('hover'); },function(){ $(this).removeClass('hover'); });
$('.program_46').hover(function(){ $(this).addClass('hover'); },function(){ $(this).removeClass('hover'); });
$('.program_47').hover(function(){ $(this).addClass('hover'); },function(){ $(this).removeClass('hover'); });
$('.program_48').hover(function(){ $(this).addClass('hover'); },function(){ $(this).removeClass('hover'); });
$('.program_49').hover(function(){ $(this).addClass('hover'); },function(){ $(this).removeClass('hover'); });
$('.program_50').hover(function(){ $(this).addClass('hover'); },function(){ $(this).removeClass('hover'); });
$('.program_53').hover(function(){ $(this).addClass('hover'); },function(){ $(this).removeClass('hover'); });
$('.program_54').hover(function(){ $(this).addClass('hover'); },function(){ $(this).removeClass('hover'); });
$('.program_55').hover(function(){ $(this).addClass('hover'); },function(){ $(this).removeClass('hover'); });
$('.program_56').hover(function(){ $(this).addClass('hover'); },function(){ $(this).removeClass('hover'); });
$('.program_57').hover(function(){ $(this).addClass('hover'); },function(){ $(this).removeClass('hover'); });
$('.program_58').hover(function(){ $(this).addClass('hover'); },function(){ $(this).removeClass('hover'); });
$('.program_59').hover(function(){ $(this).addClass('hover'); },function(){ $(this).removeClass('hover'); });
$('.program_60').hover(function(){ $(this).addClass('hover'); },function(){ $(this).removeClass('hover'); });
$('.program_61').hover(function(){ $(this).addClass('hover'); },function(){ $(this).removeClass('hover'); });
$('.program_62').hover(function(){ $(this).addClass('hover'); },function(){ $(this).removeClass('hover'); });
$('.program_63').hover(function(){ $(this).addClass('hover'); },function(){ $(this).removeClass('hover'); });
$('.program_64').hover(function(){ $(this).addClass('hover'); },function(){ $(this).removeClass('hover'); });
$('.program_65').hover(function(){ $(this).addClass('hover'); },function(){ $(this).removeClass('hover'); });
$('.program_66').hover(function(){ $(this).addClass('hover'); },function(){ $(this).removeClass('hover'); });
$('.program_67').hover(function(){ $(this).addClass('hover'); },function(){ $(this).removeClass('hover'); });
$('.program_69').hover(function(){ $(this).addClass('hover'); },function(){ $(this).removeClass('hover'); });
$('.program_70').hover(function(){ $(this).addClass('hover'); },function(){ $(this).removeClass('hover'); });
$('.program_71').hover(function(){ $(this).addClass('hover'); },function(){ $(this).removeClass('hover'); });
$('.program_76').hover(function(){ $(this).addClass('hover'); },function(){ $(this).removeClass('hover'); });
$('.program_77').hover(function(){ $(this).addClass('hover'); },function(){ $(this).removeClass('hover'); });
$('.program_79').hover(function(){ $(this).addClass('hover'); },function(){ $(this).removeClass('hover'); });
$('.program_80').hover(function(){ $(this).addClass('hover'); },function(){ $(this).removeClass('hover'); });
$('.program_81').hover(function(){ $(this).addClass('hover'); },function(){ $(this).removeClass('hover'); });
$('.program_84').hover(function(){ $(this).addClass('hover'); },function(){ $(this).removeClass('hover'); });
$('.program_85').hover(function(){ $(this).addClass('hover'); },function(){ $(this).removeClass('hover'); });
$('.program_86').hover(function(){ $(this).addClass('hover'); },function(){ $(this).removeClass('hover'); });
$('.program_87').hover(function(){ $(this).addClass('hover'); },function(){ $(this).removeClass('hover'); });
$('.program_88').hover(function(){ $(this).addClass('hover'); },function(){ $(this).removeClass('hover'); });
$('.program_89').hover(function(){ $(this).addClass('hover'); },function(){ $(this).removeClass('hover'); });
$('.program_92').hover(function(){ $(this).addClass('hover'); },function(){ $(this).removeClass('hover'); });
$('.program_93').hover(function(){ $(this).addClass('hover'); },function(){ $(this).removeClass('hover'); });
$('.program_94').hover(function(){ $(this).addClass('hover'); },function(){ $(this).removeClass('hover'); });
$('.program_95').hover(function(){ $(this).addClass('hover'); },function(){ $(this).removeClass('hover'); });
$('.program_96').hover(function(){ $(this).addClass('hover'); },function(){ $(this).removeClass('hover'); });
$('.program_97').hover(function(){ $(this).addClass('hover'); },function(){ $(this).removeClass('hover'); });
$('.program_98').hover(function(){ $(this).addClass('hover'); },function(){ $(this).removeClass('hover'); });
$('.program_100').hover(function(){ $(this).addClass('hover'); },function(){ $(this).removeClass('hover'); });
$('.program_102').hover(function(){ $(this).addClass('hover'); },function(){ $(this).removeClass('hover'); });
$('.program_103').hover(function(){ $(this).addClass('hover'); },function(){ $(this).removeClass('hover'); });
$('.program_104').hover(function(){ $(this).addClass('hover'); },function(){ $(this).removeClass('hover'); });
$('.program_105').hover(function(){ $(this).addClass('hover'); },function(){ $(this).removeClass('hover'); });
$('.program_106').hover(function(){ $(this).addClass('hover'); },function(){ $(this).removeClass('hover'); });
$('.program_107').hover(function(){ $(this).addClass('hover'); },function(){ $(this).removeClass('hover'); });
$('.program_109').hover(function(){ $(this).addClass('hover'); },function(){ $(this).removeClass('hover'); });
$('.program_110').hover(function(){ $(this).addClass('hover'); },function(){ $(this).removeClass('hover'); });
$('.program_111').hover(function(){ $(this).addClass('hover'); },function(){ $(this).removeClass('hover'); });
$('.program_112').hover(function(){ $(this).addClass('hover'); },function(){ $(this).removeClass('hover'); });
$('.program_113').hover(function(){ $(this).addClass('hover'); },function(){ $(this).removeClass('hover'); });
$('.program_121').hover(function(){ $(this).addClass('hover'); },function(){ $(this).removeClass('hover'); });
$('.program_122').hover(function(){ $(this).addClass('hover'); },function(){ $(this).removeClass('hover'); });
$('.program_123').hover(function(){ $(this).addClass('hover'); },function(){ $(this).removeClass('hover'); });
$('.program_124').hover(function(){ $(this).addClass('hover'); },function(){ $(this).removeClass('hover'); });
$('.program_127').hover(function(){ $(this).addClass('hover'); },function(){ $(this).removeClass('hover'); });
$('.program_128').hover(function(){ $(this).addClass('hover'); },function(){ $(this).removeClass('hover'); });
$('.program_129').hover(function(){ $(this).addClass('hover'); },function(){ $(this).removeClass('hover'); });
$('.program_130').hover(function(){ $(this).addClass('hover'); },function(){ $(this).removeClass('hover'); });
$('.program_131').hover(function(){ $(this).addClass('hover'); },function(){ $(this).removeClass('hover'); });
$('.program_134').hover(function(){ $(this).addClass('hover'); },function(){ $(this).removeClass('hover'); });
$('.program_135').hover(function(){ $(this).addClass('hover'); },function(){ $(this).removeClass('hover'); });
$('.program_136').hover(function(){ $(this).addClass('hover'); },function(){ $(this).removeClass('hover'); });
$('.program_137').hover(function(){ $(this).addClass('hover'); },function(){ $(this).removeClass('hover'); });
$('.program_138').hover(function(){ $(this).addClass('hover'); },function(){ $(this).removeClass('hover'); });
$('.program_139').hover(function(){ $(this).addClass('hover'); },function(){ $(this).removeClass('hover'); });
$('.program_140').hover(function(){ $(this).addClass('hover'); },function(){ $(this).removeClass('hover'); });
$('.program_141').hover(function(){ $(this).addClass('hover'); },function(){ $(this).removeClass('hover'); });
$('.program_142').hover(function(){ $(this).addClass('hover'); },function(){ $(this).removeClass('hover'); });
$('.program_143').hover(function(){ $(this).addClass('hover'); },function(){ $(this).removeClass('hover'); });
$('.program_145').hover(function(){ $(this).addClass('hover'); },function(){ $(this).removeClass('hover'); });
$('.program_146').hover(function(){ $(this).addClass('hover'); },function(){ $(this).removeClass('hover'); });
$('.program_147').hover(function(){ $(this).addClass('hover'); },function(){ $(this).removeClass('hover'); });
$('.program_148').hover(function(){ $(this).addClass('hover'); },function(){ $(this).removeClass('hover'); });
$('.program_152').hover(function(){ $(this).addClass('hover'); },function(){ $(this).removeClass('hover'); });
$('.program_153').hover(function(){ $(this).addClass('hover'); },function(){ $(this).removeClass('hover'); });
$('.program_154').hover(function(){ $(this).addClass('hover'); },function(){ $(this).removeClass('hover'); });
$('.program_161').hover(function(){ $(this).addClass('hover'); },function(){ $(this).removeClass('hover'); });
$('.program_162').hover(function(){ $(this).addClass('hover'); },function(){ $(this).removeClass('hover'); });
$('.program_164').hover(function(){ $(this).addClass('hover'); },function(){ $(this).removeClass('hover'); });
$('.program_165').hover(function(){ $(this).addClass('hover'); },function(){ $(this).removeClass('hover'); });
$('.program_166').hover(function(){ $(this).addClass('hover'); },function(){ $(this).removeClass('hover'); });
$('.program_167').hover(function(){ $(this).addClass('hover'); },function(){ $(this).removeClass('hover'); });
$('.program_168').hover(function(){ $(this).addClass('hover'); },function(){ $(this).removeClass('hover'); });
$('.program_169').hover(function(){ $(this).addClass('hover'); },function(){ $(this).removeClass('hover'); });
$('.program_171').hover(function(){ $(this).addClass('hover'); },function(){ $(this).removeClass('hover'); });
$('.program_173').hover(function(){ $(this).addClass('hover'); },function(){ $(this).removeClass('hover'); });
$('.program_174').hover(function(){ $(this).addClass('hover'); },function(){ $(this).removeClass('hover'); });
$('.program_176').hover(function(){ $(this).addClass('hover'); },function(){ $(this).removeClass('hover'); });
$('.program_177').hover(function(){ $(this).addClass('hover'); },function(){ $(this).removeClass('hover'); });
$('.program_178').hover(function(){ $(this).addClass('hover'); },function(){ $(this).removeClass('hover'); });
$('.program_180').hover(function(){ $(this).addClass('hover'); },function(){ $(this).removeClass('hover'); });
$('.program_181').hover(function(){ $(this).addClass('hover'); },function(){ $(this).removeClass('hover'); });
$('.program_182').hover(function(){ $(this).addClass('hover'); },function(){ $(this).removeClass('hover'); });
$('.program_183').hover(function(){ $(this).addClass('hover'); },function(){ $(this).removeClass('hover'); });
$('.program_184').hover(function(){ $(this).addClass('hover'); },function(){ $(this).removeClass('hover'); });
$('.program_187').hover(function(){ $(this).addClass('hover'); },function(){ $(this).removeClass('hover'); });
$('.program_188').hover(function(){ $(this).addClass('hover'); },function(){ $(this).removeClass('hover'); });
$('.program_190').hover(function(){ $(this).addClass('hover'); },function(){ $(this).removeClass('hover'); });
$('.program_191').hover(function(){ $(this).addClass('hover'); },function(){ $(this).removeClass('hover'); });
$('.program_192').hover(function(){ $(this).addClass('hover'); },function(){ $(this).removeClass('hover'); });
$('.program_193').hover(function(){ $(this).addClass('hover'); },function(){ $(this).removeClass('hover'); });
$('.program_195').hover(function(){ $(this).addClass('hover'); },function(){ $(this).removeClass('hover'); });
$('.program_196').hover(function(){ $(this).addClass('hover'); },function(){ $(this).removeClass('hover'); });
$('.program_198').hover(function(){ $(this).addClass('hover'); },function(){ $(this).removeClass('hover'); });
$('.program_200').hover(function(){ $(this).addClass('hover'); },function(){ $(this).removeClass('hover'); });
$('.program_201').hover(function(){ $(this).addClass('hover'); },function(){ $(this).removeClass('hover'); });
$('.program_202').hover(function(){ $(this).addClass('hover'); },function(){ $(this).removeClass('hover'); });
$('.program_209').hover(function(){ $(this).addClass('hover'); },function(){ $(this).removeClass('hover'); });
$('.program_210').hover(function(){ $(this).addClass('hover'); },function(){ $(this).removeClass('hover'); });
$('.program_211').hover(function(){ $(this).addClass('hover'); },function(){ $(this).removeClass('hover'); });
$('.program_212').hover(function(){ $(this).addClass('hover'); },function(){ $(this).removeClass('hover'); });
$('.program_213').hover(function(){ $(this).addClass('hover'); },function(){ $(this).removeClass('hover'); });
$('.program_214').hover(function(){ $(this).addClass('hover'); },function(){ $(this).removeClass('hover'); });
$('.program_215').hover(function(){ $(this).addClass('hover'); },function(){ $(this).removeClass('hover'); });
$('.program_216').hover(function(){ $(this).addClass('hover'); },function(){ $(this).removeClass('hover'); });
$('.program_217').hover(function(){ $(this).addClass('hover'); },function(){ $(this).removeClass('hover'); });
$('.program_218').hover(function(){ $(this).addClass('hover'); },function(){ $(this).removeClass('hover'); });
$('.program_219').hover(function(){ $(this).addClass('hover'); },function(){ $(this).removeClass('hover'); });
$('.program_220').hover(function(){ $(this).addClass('hover'); },function(){ $(this).removeClass('hover'); });
$('.program_221').hover(function(){ $(this).addClass('hover'); },function(){ $(this).removeClass('hover'); });
$('.program_222').hover(function(){ $(this).addClass('hover'); },function(){ $(this).removeClass('hover'); });
$('.program_223').hover(function(){ $(this).addClass('hover'); },function(){ $(this).removeClass('hover'); });
$('.program_224').hover(function(){ $(this).addClass('hover'); },function(){ $(this).removeClass('hover'); });
$('.program_225').hover(function(){ $(this).addClass('hover'); },function(){ $(this).removeClass('hover'); });
$('.program_231').hover(function(){ $(this).addClass('hover'); },function(){ $(this).removeClass('hover'); });
$('.program_233').hover(function(){ $(this).addClass('hover'); },function(){ $(this).removeClass('hover'); });
$('.program_234').hover(function(){ $(this).addClass('hover'); },function(){ $(this).removeClass('hover'); });
$('.program_235').hover(function(){ $(this).addClass('hover'); },function(){ $(this).removeClass('hover'); });
$('.program_236').hover(function(){ $(this).addClass('hover'); },function(){ $(this).removeClass('hover'); });
$('.program_237').hover(function(){ $(this).addClass('hover'); },function(){ $(this).removeClass('hover'); });
$('.program_238').hover(function(){ $(this).addClass('hover'); },function(){ $(this).removeClass('hover'); });
$('.program_239').hover(function(){ $(this).addClass('hover'); },function(){ $(this).removeClass('hover'); });
$('.program_240').hover(function(){ $(this).addClass('hover'); },function(){ $(this).removeClass('hover'); });
$('.program_242').hover(function(){ $(this).addClass('hover'); },function(){ $(this).removeClass('hover'); });
$('.program_243').hover(function(){ $(this).addClass('hover'); },function(){ $(this).removeClass('hover'); });
$('.program_244').hover(function(){ $(this).addClass('hover'); },function(){ $(this).removeClass('hover'); });
$('.program_245').hover(function(){ $(this).addClass('hover'); },function(){ $(this).removeClass('hover'); });
$('.program_246').hover(function(){ $(this).addClass('hover'); },function(){ $(this).removeClass('hover'); });
$('.program_247').hover(function(){ $(this).addClass('hover'); },function(){ $(this).removeClass('hover'); });
$('.program_253').hover(function(){ $(this).addClass('hover'); },function(){ $(this).removeClass('hover'); });
$('.program_254').hover(function(){ $(this).addClass('hover'); },function(){ $(this).removeClass('hover'); });
$('.program_255').hover(function(){ $(this).addClass('hover'); },function(){ $(this).removeClass('hover'); });
$('.program_256').hover(function(){ $(this).addClass('hover'); },function(){ $(this).removeClass('hover'); });
$('.program_257').hover(function(){ $(this).addClass('hover'); },function(){ $(this).removeClass('hover'); });
$('.program_258').hover(function(){ $(this).addClass('hover'); },function(){ $(this).removeClass('hover'); });
$('.program_259').hover(function(){ $(this).addClass('hover'); },function(){ $(this).removeClass('hover'); });
$('.program_260').hover(function(){ $(this).addClass('hover'); },function(){ $(this).removeClass('hover'); });
$('.program_261').hover(function(){ $(this).addClass('hover'); },function(){ $(this).removeClass('hover'); });
$('.program_262').hover(function(){ $(this).addClass('hover'); },function(){ $(this).removeClass('hover'); });
$('.program_263').hover(function(){ $(this).addClass('hover'); },function(){ $(this).removeClass('hover'); });
$('.program_266').hover(function(){ $(this).addClass('hover'); },function(){ $(this).removeClass('hover'); });
$('.program_267').hover(function(){ $(this).addClass('hover'); },function(){ $(this).removeClass('hover'); });
$('.program_268').hover(function(){ $(this).addClass('hover'); },function(){ $(this).removeClass('hover'); });
$('.program_269').hover(function(){ $(this).addClass('hover'); },function(){ $(this).removeClass('hover'); });
$('.program_270').hover(function(){ $(this).addClass('hover'); },function(){ $(this).removeClass('hover'); });
$('.program_271').hover(function(){ $(this).addClass('hover'); },function(){ $(this).removeClass('hover'); });
$('.program_272').hover(function(){ $(this).addClass('hover'); },function(){ $(this).removeClass('hover'); });
$('.program_274').hover(function(){ $(this).addClass('hover'); },function(){ $(this).removeClass('hover'); });
$('.program_275').hover(function(){ $(this).addClass('hover'); },function(){ $(this).removeClass('hover'); });
$('.program_276').hover(function(){ $(this).addClass('hover'); },function(){ $(this).removeClass('hover'); });
$('.program_277').hover(function(){ $(this).addClass('hover'); },function(){ $(this).removeClass('hover'); });
$('.program_278').hover(function(){ $(this).addClass('hover'); },function(){ $(this).removeClass('hover'); });
$('.program_280').hover(function(){ $(this).addClass('hover'); },function(){ $(this).removeClass('hover'); });
$('.program_283').hover(function(){ $(this).addClass('hover'); },function(){ $(this).removeClass('hover'); });
$('.program_289').hover(function(){ $(this).addClass('hover'); },function(){ $(this).removeClass('hover'); });
$('.program_290').hover(function(){ $(this).addClass('hover'); },function(){ $(this).removeClass('hover'); });
$('.program_291').hover(function(){ $(this).addClass('hover'); },function(){ $(this).removeClass('hover'); });
$('.program_292').hover(function(){ $(this).addClass('hover'); },function(){ $(this).removeClass('hover'); });
$('.program_293').hover(function(){ $(this).addClass('hover'); },function(){ $(this).removeClass('hover'); });
$('.program_294').hover(function(){ $(this).addClass('hover'); },function(){ $(this).removeClass('hover'); });
$('.program_295').hover(function(){ $(this).addClass('hover'); },function(){ $(this).removeClass('hover'); });
$('.program_296').hover(function(){ $(this).addClass('hover'); },function(){ $(this).removeClass('hover'); });
$('.program_297').hover(function(){ $(this).addClass('hover'); },function(){ $(this).removeClass('hover'); });
$('.program_298').hover(function(){ $(this).addClass('hover'); },function(){ $(this).removeClass('hover'); });
$('.program_299').hover(function(){ $(this).addClass('hover'); },function(){ $(this).removeClass('hover'); });
$('.program_302').hover(function(){ $(this).addClass('hover'); },function(){ $(this).removeClass('hover'); });
$('.program_303').hover(function(){ $(this).addClass('hover'); },function(){ $(this).removeClass('hover'); });
$('.program_304').hover(function(){ $(this).addClass('hover'); },function(){ $(this).removeClass('hover'); });
$('.program_305').hover(function(){ $(this).addClass('hover'); },function(){ $(this).removeClass('hover'); });
$('.program_306').hover(function(){ $(this).addClass('hover'); },function(){ $(this).removeClass('hover'); });
$('.program_307').hover(function(){ $(this).addClass('hover'); },function(){ $(this).removeClass('hover'); });
$('.program_308').hover(function(){ $(this).addClass('hover'); },function(){ $(this).removeClass('hover'); });
$('.program_309').hover(function(){ $(this).addClass('hover'); },function(){ $(this).removeClass('hover'); });
$('.program_310').hover(function(){ $(this).addClass('hover'); },function(){ $(this).removeClass('hover'); });
$('.program_311').hover(function(){ $(this).addClass('hover'); },function(){ $(this).removeClass('hover'); });
$('.program_312').hover(function(){ $(this).addClass('hover'); },function(){ $(this).removeClass('hover'); });
$('.program_313').hover(function(){ $(this).addClass('hover'); },function(){ $(this).removeClass('hover'); });
$('.program_314').hover(function(){ $(this).addClass('hover'); },function(){ $(this).removeClass('hover'); });
$('.program_315').hover(function(){ $(this).addClass('hover'); },function(){ $(this).removeClass('hover'); });
$('.program_317').hover(function(){ $(this).addClass('hover'); },function(){ $(this).removeClass('hover'); });
$('.program_319').hover(function(){ $(this).addClass('hover'); },function(){ $(this).removeClass('hover'); });
$('.program_320').hover(function(){ $(this).addClass('hover'); },function(){ $(this).removeClass('hover'); });
$(window).unload(function(){ $(this).removeClass('hover'); });
});

jQuery とか知らんので間違ってる可能性大ですが、文字列の結合でどうにかならんのでしょうか? 例えば…

$(function(){
    for (var i = 2; i <= 320; i++) {
        $('.program' + (i > 2 ? '_' : '') + i).hover(
            function(){$(this).addClass('hover')},
            function(){$(this).removeClass('hover')}
        );
    }
    $(window).unload(function(){$(this).removeClass('hover')});
});

こういうので動かないのかなぁ…、謎。

Python Script も酷いのが在るね。

class Post(db.Model):
    user    = db.UserProperty()
    ct      = db.IntegerProperty()
    uid     = db.StringProperty()
    indx    = db.StringProperty()
    title   = db.StringProperty()
    entry = db.StringProperty(multiline=True)
    entry1 = db.StringProperty(multiline=True)
    entry2 = db.StringProperty(multiline=True)
    entry3 = db.StringProperty(multiline=True)
    entry4 = db.StringProperty(multiline=True)
    entry5 = db.StringProperty(multiline=True)
    entry6 = db.StringProperty(multiline=True)
    entry7 = db.StringProperty(multiline=True)
    entry8 = db.StringProperty(multiline=True)
    entry9 = db.StringProperty(multiline=True)
    entry10 = db.StringProperty(multiline=True)
    entry11 = db.StringProperty(multiline=True)
    entry12 = db.StringProperty(multiline=True)
    entry13 = db.StringProperty(multiline=True)
    entry14 = db.StringProperty(multiline=True)
    entry15 = db.StringProperty(multiline=True)
    entry16 = db.StringProperty(multiline=True)
    entry17 = db.StringProperty(multiline=True)
    entry18 = db.StringProperty(multiline=True)
    entry19 = db.StringProperty(multiline=True)
    entry20 = db.StringProperty(multiline=True)
    entry21 = db.StringProperty(multiline=True)
    entry22 = db.StringProperty(multiline=True)
    entry23 = db.StringProperty(multiline=True)
    entry24 = db.StringProperty(multiline=True)
    entry25 = db.StringProperty(multiline=True)
    entry26 = db.StringProperty(multiline=True)
    entry27 = db.StringProperty(multiline=True)
    entry28 = db.StringProperty(multiline=True)
    entry29 = db.StringProperty(multiline=True)
    entry30 = db.StringProperty(multiline=True)
    entry31 = db.StringProperty(multiline=True)
    entry32 = db.StringProperty(multiline=True)
    entry33 = db.StringProperty(multiline=True)
    entry34 = db.StringProperty(multiline=True)
    entry35 = db.StringProperty(multiline=True)
    entry36 = db.StringProperty(multiline=True)
    entry37 = db.StringProperty(multiline=True)
    entry38 = db.StringProperty(multiline=True)
    entry39 = db.StringProperty(multiline=True)
    entry40 = db.StringProperty(multiline=True)
    entry41 = db.StringProperty(multiline=True)
    entry42 = db.StringProperty(multiline=True)
    entry43 = db.StringProperty(multiline=True)
    entry44 = db.StringProperty(multiline=True)
    entry45 = db.StringProperty(multiline=True)
    entry46 = db.StringProperty(multiline=True)
    entry47 = db.StringProperty(multiline=True)
    entry48 = db.StringProperty(multiline=True)
    entry49 = db.StringProperty(multiline=True)
    entry50 = db.StringProperty(multiline=True)
    entry51 = db.StringProperty(multiline=True)
    entry52 = db.StringProperty(multiline=True)
    entry53 = db.StringProperty(multiline=True)
    entry54 = db.StringProperty(multiline=True)
    entry55 = db.StringProperty(multiline=True)
    entry56 = db.StringProperty(multiline=True)
    entry57 = db.StringProperty(multiline=True)
    entry58 = db.StringProperty(multiline=True)
    entry59 = db.StringProperty(multiline=True)
    entry60 = db.StringProperty(multiline=True)
    entry61 = db.StringProperty(multiline=True)
    entry62 = db.StringProperty(multiline=True)
    entry63 = db.StringProperty(multiline=True)
    entry64 = db.StringProperty(multiline=True)
    entry65 = db.StringProperty(multiline=True)
    entry66 = db.StringProperty(multiline=True)
    entry67 = db.StringProperty(multiline=True)
    entry68 = db.StringProperty(multiline=True)
    entry69 = db.StringProperty(multiline=True)
    entry70 = db.StringProperty(multiline=True)
    entry71 = db.StringProperty(multiline=True)
    entry72 = db.StringProperty(multiline=True)
    entry73 = db.StringProperty(multiline=True)
    entry74 = db.StringProperty(multiline=True)
    entry75 = db.StringProperty(multiline=True)
    entry76 = db.StringProperty(multiline=True)
    entry77 = db.StringProperty(multiline=True)
    entry78 = db.StringProperty(multiline=True)
    entry79 = db.StringProperty(multiline=True)
    entry80 = db.StringProperty(multiline=True)
    entry81 = db.StringProperty(multiline=True)
    entry82 = db.StringProperty(multiline=True)
    entry83 = db.StringProperty(multiline=True)
    entry84 = db.StringProperty(multiline=True)
    entry85 = db.StringProperty(multiline=True)
    entry86 = db.StringProperty(multiline=True)
    entry87 = db.StringProperty(multiline=True)
    entry88 = db.StringProperty(multiline=True)
    entry89 = db.StringProperty(multiline=True)
    entry90 = db.StringProperty(multiline=True)
    entry91 = db.StringProperty(multiline=True)
    entry92 = db.StringProperty(multiline=True)
    entry93 = db.StringProperty(multiline=True)
    entry94 = db.StringProperty(multiline=True)
    entry95 = db.StringProperty(multiline=True)
    entry96 = db.StringProperty(multiline=True)
    entry97 = db.StringProperty(multiline=True)
    entry98 = db.StringProperty(multiline=True)
    entry99 = db.StringProperty(multiline=True)
    entry100 = db.StringProperty(multiline=True)
    entry101 = db.StringProperty(multiline=True)
    entry102 = db.StringProperty(multiline=True)
    entry103 = db.StringProperty(multiline=True)
    entry104 = db.StringProperty(multiline=True)
    entry105 = db.StringProperty(multiline=True)
    entry106 = db.StringProperty(multiline=True)
    entry107 = db.StringProperty(multiline=True)
    entry108 = db.StringProperty(multiline=True)
    entry109 = db.StringProperty(multiline=True)
    entry110 = db.StringProperty(multiline=True)
    entry111 = db.StringProperty(multiline=True)
    entry112 = db.StringProperty(multiline=True)
    entry113 = db.StringProperty(multiline=True)
    entry114 = db.StringProperty(multiline=True)
    entry115 = db.StringProperty(multiline=True)
    entry116 = db.StringProperty(multiline=True)
    entry117 = db.StringProperty(multiline=True)
    entry118 = db.StringProperty(multiline=True)
    entry119 = db.StringProperty(multiline=True)
    entry120 = db.StringProperty(multiline=True)
    entry121 = db.StringProperty(multiline=True)
    entry122 = db.StringProperty(multiline=True)
    entry123 = db.StringProperty(multiline=True)
    entry124 = db.StringProperty(multiline=True)
    entry125 = db.StringProperty(multiline=True)
    entry126 = db.StringProperty(multiline=True)
    entry127 = db.StringProperty(multiline=True)
    entry128 = db.StringProperty(multiline=True)
    entry129 = db.StringProperty(multiline=True)
    entry130 = db.StringProperty(multiline=True)
    entry131 = db.StringProperty(multiline=True)
    entry132 = db.StringProperty(multiline=True)
    entry133 = db.StringProperty(multiline=True)
    entry134 = db.StringProperty(multiline=True)
    entry135 = db.StringProperty(multiline=True)
    entry136 = db.StringProperty(multiline=True)
    entry137 = db.StringProperty(multiline=True)
    entry138 = db.StringProperty(multiline=True)
    entry139 = db.StringProperty(multiline=True)
    entry140 = db.StringProperty(multiline=True)
    entry141 = db.StringProperty(multiline=True)
    entry142 = db.StringProperty(multiline=True)
    entry143 = db.StringProperty(multiline=True)
    entry144 = db.StringProperty(multiline=True)
    entry145 = db.StringProperty(multiline=True)
    entry146 = db.StringProperty(multiline=True)
    entry147 = db.StringProperty(multiline=True)
    entry148 = db.StringProperty(multiline=True)
    entry149 = db.StringProperty(multiline=True)
    entry150 = db.StringProperty(multiline=True)
    entry151 = db.StringProperty(multiline=True)
    entry152 = db.StringProperty(multiline=True)
    entry153 = db.StringProperty(multiline=True)
    entry154 = db.StringProperty(multiline=True)
    entry155 = db.StringProperty(multiline=True)
    entry156 = db.StringProperty(multiline=True)
    entry157 = db.StringProperty(multiline=True)
    entry158 = db.StringProperty(multiline=True)
    entry159 = db.StringProperty(multiline=True)
    entry160 = db.StringProperty(multiline=True)
    entry161 = db.StringProperty(multiline=True)
    entry162 = db.StringProperty(multiline=True)
    entry163 = db.StringProperty(multiline=True)
    entry164 = db.StringProperty(multiline=True)
    entry165 = db.StringProperty(multiline=True)
    entry166 = db.StringProperty(multiline=True)
    entry167 = db.StringProperty(multiline=True)
    entry168 = db.StringProperty(multiline=True)
    entry169 = db.StringProperty(multiline=True)
    entry170 = db.StringProperty(multiline=True)
    entry171 = db.StringProperty(multiline=True)
    entry172 = db.StringProperty(multiline=True)
    entry173 = db.StringProperty(multiline=True)
    entry174 = db.StringProperty(multiline=True)
    entry175 = db.StringProperty(multiline=True)
    entry176 = db.StringProperty(multiline=True)
    entry177 = db.StringProperty(multiline=True)
    entry178 = db.StringProperty(multiline=True)
    entry179 = db.StringProperty(multiline=True)
    entry180 = db.StringProperty(multiline=True)
    entry181 = db.StringProperty(multiline=True)
    entry182 = db.StringProperty(multiline=True)
    entry183 = db.StringProperty(multiline=True)
    entry184 = db.StringProperty(multiline=True)
    entry185 = db.StringProperty(multiline=True)
    entry186 = db.StringProperty(multiline=True)
    entry187 = db.StringProperty(multiline=True)
    entry188 = db.StringProperty(multiline=True)
    entry189 = db.StringProperty(multiline=True)
    entry190 = db.StringProperty(multiline=True)
    entry191 = db.StringProperty(multiline=True)
    entry192 = db.StringProperty(multiline=True)
    entry193 = db.StringProperty(multiline=True)
    entry194 = db.StringProperty(multiline=True)
    entry195 = db.StringProperty(multiline=True)
    entry196 = db.StringProperty(multiline=True)
    entry197 = db.StringProperty(multiline=True)
    entry198 = db.StringProperty(multiline=True)
    entry199 = db.StringProperty(multiline=True)
    entry200 = db.StringProperty(multiline=True)
    entry201 = db.StringProperty(multiline=True)
    entry202 = db.StringProperty(multiline=True)
    entry203 = db.StringProperty(multiline=True)
    entry204 = db.StringProperty(multiline=True)
    entry205 = db.StringProperty(multiline=True)
    entry206 = db.StringProperty(multiline=True)
    entry207 = db.StringProperty(multiline=True)
    entry208 = db.StringProperty(multiline=True)
    entry209 = db.StringProperty(multiline=True)
    entry210 = db.StringProperty(multiline=True)
    entry211 = db.StringProperty(multiline=True)
    entry212 = db.StringProperty(multiline=True)
    entry213 = db.StringProperty(multiline=True)
    entry214 = db.StringProperty(multiline=True)
    entry215 = db.StringProperty(multiline=True)
    entry216 = db.StringProperty(multiline=True)
    entry217 = db.StringProperty(multiline=True)
    entry218 = db.StringProperty(multiline=True)
    entry219 = db.StringProperty(multiline=True)
    entry220 = db.StringProperty(multiline=True)
    entry221 = db.StringProperty(multiline=True)
    entry222 = db.StringProperty(multiline=True)
    entry223 = db.StringProperty(multiline=True)
    entry224 = db.StringProperty(multiline=True)
    entry225 = db.StringProperty(multiline=True)
    entry226 = db.StringProperty(multiline=True)
    entry227 = db.StringProperty(multiline=True)
    entry228 = db.StringProperty(multiline=True)
    entry229 = db.StringProperty(multiline=True)
    entry230 = db.StringProperty(multiline=True)
    entry231 = db.StringProperty(multiline=True)
    entry232 = db.StringProperty(multiline=True)
    entry233 = db.StringProperty(multiline=True)
    entry234 = db.StringProperty(multiline=True)
    entry235 = db.StringProperty(multiline=True)
    entry236 = db.StringProperty(multiline=True)
    entry237 = db.StringProperty(multiline=True)
    entry238 = db.StringProperty(multiline=True)
    entry239 = db.StringProperty(multiline=True)
    entry240 = db.StringProperty(multiline=True)
    entry241 = db.StringProperty(multiline=True)
    entry242 = db.StringProperty(multiline=True)
    entry243 = db.StringProperty(multiline=True)
    entry244 = db.StringProperty(multiline=True)
    entry245 = db.StringProperty(multiline=True)
    entry246 = db.StringProperty(multiline=True)
    entry247 = db.StringProperty(multiline=True)
    entry248 = db.StringProperty(multiline=True)
    entry249 = db.StringProperty(multiline=True)
    entry250 = db.StringProperty(multiline=True)
    entry251 = db.StringProperty(multiline=True)
    entry252 = db.StringProperty(multiline=True)
    entry253 = db.StringProperty(multiline=True)
    entry254 = db.StringProperty(multiline=True)
    entry255 = db.StringProperty(multiline=True)
    entry256 = db.StringProperty(multiline=True)
    entry257 = db.StringProperty(multiline=True)
    entry258 = db.StringProperty(multiline=True)
    entry259 = db.StringProperty(multiline=True)
    entry260 = db.StringProperty(multiline=True)
    entry261 = db.StringProperty(multiline=True)
    entry262 = db.StringProperty(multiline=True)
    entry263 = db.StringProperty(multiline=True)
    entry264 = db.StringProperty(multiline=True)
    entry265 = db.StringProperty(multiline=True)
    entry266 = db.StringProperty(multiline=True)
    entry267 = db.StringProperty(multiline=True)
    entry268 = db.StringProperty(multiline=True)
    entry269 = db.StringProperty(multiline=True)
    entry270 = db.StringProperty(multiline=True)
    entry271 = db.StringProperty(multiline=True)
    entry272 = db.StringProperty(multiline=True)
    entry273 = db.StringProperty(multiline=True)
    entry274 = db.StringProperty(multiline=True)
    entry275 = db.StringProperty(multiline=True)
    entry276 = db.StringProperty(multiline=True)
    entry277 = db.StringProperty(multiline=True)
    entry278 = db.StringProperty(multiline=True)
    entry279 = db.StringProperty(multiline=True)
    entry280 = db.StringProperty(multiline=True)
    entry281 = db.StringProperty(multiline=True)
    entry282 = db.StringProperty(multiline=True)
    entry283 = db.StringProperty(multiline=True)
    entry284 = db.StringProperty(multiline=True)
    entry285 = db.StringProperty(multiline=True)
    entry286 = db.StringProperty(multiline=True)
    entry287 = db.StringProperty(multiline=True)
    entry288 = db.StringProperty(multiline=True)
    entry289 = db.StringProperty(multiline=True)
    entry290 = db.StringProperty(multiline=True)
    entry291 = db.StringProperty(multiline=True)
    entry292 = db.StringProperty(multiline=True)
    entry293 = db.StringProperty(multiline=True)
    entry294 = db.StringProperty(multiline=True)
    entry295 = db.StringProperty(multiline=True)
    entry296 = db.StringProperty(multiline=True)
    entry297 = db.StringProperty(multiline=True)
    entry298 = db.StringProperty(multiline=True)
    entry299 = db.StringProperty(multiline=True)
    entry300 = db.StringProperty(multiline=True)
    entry301 = db.StringProperty(multiline=True)
    entry302 = db.StringProperty(multiline=True)
    entry303 = db.StringProperty(multiline=True)
    entry304 = db.StringProperty(multiline=True)
    entry305 = db.StringProperty(multiline=True)
    entry306 = db.StringProperty(multiline=True)
    entry307 = db.StringProperty(multiline=True)
    entry308 = db.StringProperty(multiline=True)
    entry309 = db.StringProperty(multiline=True)
    entry310 = db.StringProperty(multiline=True)
    entry311 = db.StringProperty(multiline=True)
    entry312 = db.StringProperty(multiline=True)
    entry313 = db.StringProperty(multiline=True)
    entry314 = db.StringProperty(multiline=True)
    entry315 = db.StringProperty(multiline=True)
    entry316 = db.StringProperty(multiline=True)
    entry317 = db.StringProperty(multiline=True)
    entry318 = db.StringProperty(multiline=True)
    entry319 = db.StringProperty(multiline=True)
    entry320 = db.StringProperty(multiline=True)
    entry321 = db.StringProperty(multiline=True)
    entry322 = db.StringProperty(multiline=True)
    entry323 = db.StringProperty(multiline=True)
    entry324 = db.StringProperty(multiline=True)
    entry325 = db.StringProperty(multiline=True)
    entry326 = db.StringProperty(multiline=True)
    entry327 = db.StringProperty(multiline=True)
    entry328 = db.StringProperty(multiline=True)
    entry329 = db.StringProperty(multiline=True)
    entry330 = db.StringProperty(multiline=True)
    entry331 = db.StringProperty(multiline=True)
    entry332 = db.StringProperty(multiline=True)
    entry333 = db.StringProperty(multiline=True)
    entry334 = db.StringProperty(multiline=True)
    entry335 = db.StringProperty(multiline=True)
    entry336 = db.StringProperty(multiline=True)
    entry337 = db.StringProperty(multiline=True)
    entry338 = db.StringProperty(multiline=True)
    entry339 = db.StringProperty(multiline=True)
    entry340 = db.StringProperty(multiline=True)
    entry341 = db.StringProperty(multiline=True)
    entry342 = db.StringProperty(multiline=True)
    entry343 = db.StringProperty(multiline=True)
    entry344 = db.StringProperty(multiline=True)
    entry345 = db.StringProperty(multiline=True)
    entry346 = db.StringProperty(multiline=True)
    entry347 = db.StringProperty(multiline=True)
    entry348 = db.StringProperty(multiline=True)
    entry349 = db.StringProperty(multiline=True)
    entry350 = db.StringProperty(multiline=True)
    entry351 = db.StringProperty(multiline=True)
    entry352 = db.StringProperty(multiline=True)
    entry353 = db.StringProperty(multiline=True)
    entry354 = db.StringProperty(multiline=True)
    entry355 = db.StringProperty(multiline=True)
    entry356 = db.StringProperty(multiline=True)
    entry357 = db.StringProperty(multiline=True)
    entry358 = db.StringProperty(multiline=True)
    entry359 = db.StringProperty(multiline=True)
    entry360 = db.StringProperty(multiline=True)
    entry361 = db.StringProperty(multiline=True)
    entry362 = db.StringProperty(multiline=True)
    entry363 = db.StringProperty(multiline=True)
    entry364 = db.StringProperty(multiline=True)
    entry365 = db.StringProperty(multiline=True)
    entry366 = db.StringProperty(multiline=True)
    entry367 = db.StringProperty(multiline=True)
    entry368 = db.StringProperty(multiline=True)
    entry369 = db.StringProperty(multiline=True)
    entry370 = db.StringProperty(multiline=True)
    entry371 = db.StringProperty(multiline=True)
    entry372 = db.StringProperty(multiline=True)
    entry373 = db.StringProperty(multiline=True)
    entry374 = db.StringProperty(multiline=True)
    entry375 = db.StringProperty(multiline=True)
    entry376 = db.StringProperty(multiline=True)
    entry377 = db.StringProperty(multiline=True)
    entry378 = db.StringProperty(multiline=True)
    entry379 = db.StringProperty(multiline=True)
    entry380 = db.StringProperty(multiline=True)
    entry381 = db.StringProperty(multiline=True)
    entry382 = db.StringProperty(multiline=True)
    entry383 = db.StringProperty(multiline=True)
    entry384 = db.StringProperty(multiline=True)
    entry385 = db.StringProperty(multiline=True)
    entry386 = db.StringProperty(multiline=True)
    entry387 = db.StringProperty(multiline=True)
    entry388 = db.StringProperty(multiline=True)
    entry389 = db.StringProperty(multiline=True)
    entry390 = db.StringProperty(multiline=True)
    entry391 = db.StringProperty(multiline=True)
    entry392 = db.StringProperty(multiline=True)
    entry393 = db.StringProperty(multiline=True)
    entry394 = db.StringProperty(multiline=True)
    entry395 = db.StringProperty(multiline=True)
    entry396 = db.StringProperty(multiline=True)
    entry397 = db.StringProperty(multiline=True)
    entry398 = db.StringProperty(multiline=True)
    entry399 = db.StringProperty(multiline=True)
    entry400 = db.StringProperty(multiline=True)
    entry401 = db.StringProperty(multiline=True)
    entry402 = db.StringProperty(multiline=True)
    entry403 = db.StringProperty(multiline=True)
    entry404 = db.StringProperty(multiline=True)
    entry405 = db.StringProperty(multiline=True)
    entry406 = db.StringProperty(multiline=True)
    entry407 = db.StringProperty(multiline=True)
    entry408 = db.StringProperty(multiline=True)
    entry409 = db.StringProperty(multiline=True)
    entry410 = db.StringProperty(multiline=True)
    entry411 = db.StringProperty(multiline=True)
    entry412 = db.StringProperty(multiline=True)
    entry413 = db.StringProperty(multiline=True)
    entry414 = db.StringProperty(multiline=True)
    entry415 = db.StringProperty(multiline=True)
    entry416 = db.StringProperty(multiline=True)
    entry417 = db.StringProperty(multiline=True)
    entry418 = db.StringProperty(multiline=True)
    entry419 = db.StringProperty(multiline=True)
    entry420 = db.StringProperty(multiline=True)
    entry421 = db.StringProperty(multiline=True)
    entry422 = db.StringProperty(multiline=True)
    entry423 = db.StringProperty(multiline=True)
    entry424 = db.StringProperty(multiline=True)
    entry425 = db.StringProperty(multiline=True)
    entry426 = db.StringProperty(multiline=True)
    entry427 = db.StringProperty(multiline=True)
    entry428 = db.StringProperty(multiline=True)
    entry429 = db.StringProperty(multiline=True)
    entry430 = db.StringProperty(multiline=True)
    entry431 = db.StringProperty(multiline=True)
    entry432 = db.StringProperty(multiline=True)
    entry433 = db.StringProperty(multiline=True)
    entry434 = db.StringProperty(multiline=True)
    entry435 = db.StringProperty(multiline=True)
    entry436 = db.StringProperty(multiline=True)
    entry437 = db.StringProperty(multiline=True)
    entry438 = db.StringProperty(multiline=True)
    entry439 = db.StringProperty(multiline=True)
    entry440 = db.StringProperty(multiline=True)
    entry441 = db.StringProperty(multiline=True)
    entry442 = db.StringProperty(multiline=True)
    entry443 = db.StringProperty(multiline=True)
    entry444 = db.StringProperty(multiline=True)
    entry445 = db.StringProperty(multiline=True)
    entry446 = db.StringProperty(multiline=True)
    entry447 = db.StringProperty(multiline=True)
    entry448 = db.StringProperty(multiline=True)
    entry449 = db.StringProperty(multiline=True)
    entry450 = db.StringProperty(multiline=True)
    entry451 = db.StringProperty(multiline=True)
    entry452 = db.StringProperty(multiline=True)
    entry453 = db.StringProperty(multiline=True)
    entry454 = db.StringProperty(multiline=True)
    entry455 = db.StringProperty(multiline=True)
    entry456 = db.StringProperty(multiline=True)
    entry457 = db.StringProperty(multiline=True)
    entry458 = db.StringProperty(multiline=True)
    entry459 = db.StringProperty(multiline=True)
    entry460 = db.StringProperty(multiline=True)
    entry461 = db.StringProperty(multiline=True)
    entry462 = db.StringProperty(multiline=True)
    entry463 = db.StringProperty(multiline=True)
    entry464 = db.StringProperty(multiline=True)
    entry465 = db.StringProperty(multiline=True)
    entry466 = db.StringProperty(multiline=True)
    entry467 = db.StringProperty(multiline=True)
    entry468 = db.StringProperty(multiline=True)
    entry469 = db.StringProperty(multiline=True)
    entry470 = db.StringProperty(multiline=True)
    entry471 = db.StringProperty(multiline=True)
    entry472 = db.StringProperty(multiline=True)
    entry473 = db.StringProperty(multiline=True)
    entry474 = db.StringProperty(multiline=True)
    entry475 = db.StringProperty(multiline=True)
    entry476 = db.StringProperty(multiline=True)
    entry477 = db.StringProperty(multiline=True)
    entry478 = db.StringProperty(multiline=True)
    entry479 = db.StringProperty(multiline=True)
    entry480 = db.StringProperty(multiline=True)
    entry481 = db.StringProperty(multiline=True)
    entry482 = db.StringProperty(multiline=True)
    entry483 = db.StringProperty(multiline=True)
    entry484 = db.StringProperty(multiline=True)
    entry485 = db.StringProperty(multiline=True)
    entry486 = db.StringProperty(multiline=True)
    entry487 = db.StringProperty(multiline=True)
    entry488 = db.StringProperty(multiline=True)
    entry489 = db.StringProperty(multiline=True)
    entry490 = db.StringProperty(multiline=True)
    entry491 = db.StringProperty(multiline=True)
    entry492 = db.StringProperty(multiline=True)
    entry493 = db.StringProperty(multiline=True)
    entry494 = db.StringProperty(multiline=True)
    entry495 = db.StringProperty(multiline=True)
    entry496 = db.StringProperty(multiline=True)
    entry497 = db.StringProperty(multiline=True)
    entry498 = db.StringProperty(multiline=True)
    entry499 = db.StringProperty(multiline=True)
    entry500 = db.StringProperty(multiline=True)
    entry501 = db.StringProperty(multiline=True)
    entry502 = db.StringProperty(multiline=True)
    entry503 = db.StringProperty(multiline=True)
    entry504 = db.StringProperty(multiline=True)
    entry505 = db.StringProperty(multiline=True)
    entry506 = db.StringProperty(multiline=True)
    entry507 = db.StringProperty(multiline=True)
    entry508 = db.StringProperty(multiline=True)
    entry509 = db.StringProperty(multiline=True)
    entry510 = db.StringProperty(multiline=True)
    entry511 = db.StringProperty(multiline=True)
    entry512 = db.StringProperty(multiline=True)
    entry513 = db.StringProperty(multiline=True)
    entry514 = db.StringProperty(multiline=True)
    entry515 = db.StringProperty(multiline=True)
    entry516 = db.StringProperty(multiline=True)
    entry517 = db.StringProperty(multiline=True)
    entry518 = db.StringProperty(multiline=True)
    entry519 = db.StringProperty(multiline=True)
    entry520 = db.StringProperty(multiline=True)
    entry521 = db.StringProperty(multiline=True)
    entry522 = db.StringProperty(multiline=True)
    entry523 = db.StringProperty(multiline=True)
    entry524 = db.StringProperty(multiline=True)
    entry525 = db.StringProperty(multiline=True)
    entry526 = db.StringProperty(multiline=True)
    entry527 = db.StringProperty(multiline=True)
    entry528 = db.StringProperty(multiline=True)
    entry529 = db.StringProperty(multiline=True)
    entry530 = db.StringProperty(multiline=True)
    entry531 = db.StringProperty(multiline=True)
    entry532 = db.StringProperty(multiline=True)
    entry533 = db.StringProperty(multiline=True)
    entry534 = db.StringProperty(multiline=True)
    entry535 = db.StringProperty(multiline=True)
    entry536 = db.StringProperty(multiline=True)
    entry537 = db.StringProperty(multiline=True)
    entry538 = db.StringProperty(multiline=True)
    entry539 = db.StringProperty(multiline=True)
    entry540 = db.StringProperty(multiline=True)
    entry541 = db.StringProperty(multiline=True)
    entry542 = db.StringProperty(multiline=True)
    entry543 = db.StringProperty(multiline=True)
    entry544 = db.StringProperty(multiline=True)
    entry545 = db.StringProperty(multiline=True)
    entry546 = db.StringProperty(multiline=True)
    entry547 = db.StringProperty(multiline=True)
    entry548 = db.StringProperty(multiline=True)
    entry549 = db.StringProperty(multiline=True)
    entry550 = db.StringProperty(multiline=True)
    entry551 = db.StringProperty(multiline=True)
    entry552 = db.StringProperty(multiline=True)
    entry553 = db.StringProperty(multiline=True)
    entry554 = db.StringProperty(multiline=True)
    entry555 = db.StringProperty(multiline=True)
    entry556 = db.StringProperty(multiline=True)
    entry557 = db.StringProperty(multiline=True)
    entry558 = db.StringProperty(multiline=True)
    entry559 = db.StringProperty(multiline=True)
    entry560 = db.StringProperty(multiline=True)
    entry561 = db.StringProperty(multiline=True)
    entry562 = db.StringProperty(multiline=True)
    entry563 = db.StringProperty(multiline=True)
    entry564 = db.StringProperty(multiline=True)
    entry565 = db.StringProperty(multiline=True)
    entry566 = db.StringProperty(multiline=True)
    entry567 = db.StringProperty(multiline=True)
    entry568 = db.StringProperty(multiline=True)
    entry569 = db.StringProperty(multiline=True)
    entry570 = db.StringProperty(multiline=True)
    entry571 = db.StringProperty(multiline=True)
    entry572 = db.StringProperty(multiline=True)
    entry573 = db.StringProperty(multiline=True)
    entry574 = db.StringProperty(multiline=True)
    entry575 = db.StringProperty(multiline=True)
    entry576 = db.StringProperty(multiline=True)
    entry577 = db.StringProperty(multiline=True)
    entry578 = db.StringProperty(multiline=True)
    entry579 = db.StringProperty(multiline=True)
    entry580 = db.StringProperty(multiline=True)
    entry581 = db.StringProperty(multiline=True)
    entry582 = db.StringProperty(multiline=True)
    entry583 = db.StringProperty(multiline=True)
    entry584 = db.StringProperty(multiline=True)
    entry585 = db.StringProperty(multiline=True)
    entry586 = db.StringProperty(multiline=True)
    entry587 = db.StringProperty(multiline=True)
    entry588 = db.StringProperty(multiline=True)
    entry589 = db.StringProperty(multiline=True)
    entry590 = db.StringProperty(multiline=True)
    entry591 = db.StringProperty(multiline=True)
    entry592 = db.StringProperty(multiline=True)
    entry593 = db.StringProperty(multiline=True)
    entry594 = db.StringProperty(multiline=True)
    entry595 = db.StringProperty(multiline=True)
    entry596 = db.StringProperty(multiline=True)
    entry597 = db.StringProperty(multiline=True)
    entry598 = db.StringProperty(multiline=True)
    entry599 = db.StringProperty(multiline=True)
    entry600 = db.StringProperty(multiline=True)
    entry601 = db.StringProperty(multiline=True)
    entry602 = db.StringProperty(multiline=True)
    entry603 = db.StringProperty(multiline=True)
    entry604 = db.StringProperty(multiline=True)
    entry605 = db.StringProperty(multiline=True)
    entry606 = db.StringProperty(multiline=True)
    entry607 = db.StringProperty(multiline=True)
    entry608 = db.StringProperty(multiline=True)
    entry609 = db.StringProperty(multiline=True)
    entry610 = db.StringProperty(multiline=True)
    entry611 = db.StringProperty(multiline=True)
    entry612 = db.StringProperty(multiline=True)
    entry613 = db.StringProperty(multiline=True)
    entry614 = db.StringProperty(multiline=True)
    entry615 = db.StringProperty(multiline=True)
    entry616 = db.StringProperty(multiline=True)
    entry617 = db.StringProperty(multiline=True)
    entry618 = db.StringProperty(multiline=True)
    entry619 = db.StringProperty(multiline=True)
    entry620 = db.StringProperty(multiline=True)
    entry621 = db.StringProperty(multiline=True)
    entry622 = db.StringProperty(multiline=True)
    entry623 = db.StringProperty(multiline=True)
    entry624 = db.StringProperty(multiline=True)
    entry625 = db.StringProperty(multiline=True)
    entry626 = db.StringProperty(multiline=True)
    entry627 = db.StringProperty(multiline=True)
    entry628 = db.StringProperty(multiline=True)
    entry629 = db.StringProperty(multiline=True)
    entry630 = db.StringProperty(multiline=True)
    entry631 = db.StringProperty(multiline=True)
    entry632 = db.StringProperty(multiline=True)
    entry633 = db.StringProperty(multiline=True)
    entry634 = db.StringProperty(multiline=True)
    entry635 = db.StringProperty(multiline=True)
    entry636 = db.StringProperty(multiline=True)
    entry637 = db.StringProperty(multiline=True)
    entry638 = db.StringProperty(multiline=True)
    entry639 = db.StringProperty(multiline=True)
    entry640 = db.StringProperty(multiline=True)
    entry641 = db.StringProperty(multiline=True)
    entry642 = db.StringProperty(multiline=True)
    entry643 = db.StringProperty(multiline=True)
    entry644 = db.StringProperty(multiline=True)
    entry645 = db.StringProperty(multiline=True)
    entry646 = db.StringProperty(multiline=True)
    entry647 = db.StringProperty(multiline=True)
    entry648 = db.StringProperty(multiline=True)
    entry649 = db.StringProperty(multiline=True)
    entry650 = db.StringProperty(multiline=True)
    entry651 = db.StringProperty(multiline=True)
    entry652 = db.StringProperty(multiline=True)
    entry653 = db.StringProperty(multiline=True)
    entry654 = db.StringProperty(multiline=True)
    entry655 = db.StringProperty(multiline=True)
    entry656 = db.StringProperty(multiline=True)
    entry657 = db.StringProperty(multiline=True)
    entry658 = db.StringProperty(multiline=True)
    entry659 = db.StringProperty(multiline=True)
    entry660 = db.StringProperty(multiline=True)
    entry661 = db.StringProperty(multiline=True)
    entry662 = db.StringProperty(multiline=True)
    entry663 = db.StringProperty(multiline=True)
    entry664 = db.StringProperty(multiline=True)
    entry665 = db.StringProperty(multiline=True)
    entry666 = db.StringProperty(multiline=True)
    entry667 = db.StringProperty(multiline=True)
    entry668 = db.StringProperty(multiline=True)
    entry669 = db.StringProperty(multiline=True)
    entry670 = db.StringProperty(multiline=True)
    entry671 = db.StringProperty(multiline=True)
    entry672 = db.StringProperty(multiline=True)
    entry673 = db.StringProperty(multiline=True)
    entry674 = db.StringProperty(multiline=True)
    entry675 = db.StringProperty(multiline=True)
    entry676 = db.StringProperty(multiline=True)
    entry677 = db.StringProperty(multiline=True)
    entry678 = db.StringProperty(multiline=True)
    entry679 = db.StringProperty(multiline=True)
    entry680 = db.StringProperty(multiline=True)
    entry681 = db.StringProperty(multiline=True)
    entry682 = db.StringProperty(multiline=True)
    entry683 = db.StringProperty(multiline=True)
    entry684 = db.StringProperty(multiline=True)
    entry685 = db.StringProperty(multiline=True)
    entry686 = db.StringProperty(multiline=True)
    entry687 = db.StringProperty(multiline=True)
    entry688 = db.StringProperty(multiline=True)
    entry689 = db.StringProperty(multiline=True)
    entry690 = db.StringProperty(multiline=True)
    entry691 = db.StringProperty(multiline=True)
    entry692 = db.StringProperty(multiline=True)
    entry693 = db.StringProperty(multiline=True)
    entry694 = db.StringProperty(multiline=True)
    entry695 = db.StringProperty(multiline=True)
    entry696 = db.StringProperty(multiline=True)
    entry697 = db.StringProperty(multiline=True)
    entry698 = db.StringProperty(multiline=True)
    entry699 = db.StringProperty(multiline=True)
    entry700 = db.StringProperty(multiline=True)
    entry701 = db.StringProperty(multiline=True)
    entry702 = db.StringProperty(multiline=True)
    entry703 = db.StringProperty(multiline=True)
    entry704 = db.StringProperty(multiline=True)
    entry705 = db.StringProperty(multiline=True)
    entry706 = db.StringProperty(multiline=True)
    entry707 = db.StringProperty(multiline=True)
    entry708 = db.StringProperty(multiline=True)
    entry709 = db.StringProperty(multiline=True)
    entry710 = db.StringProperty(multiline=True)
    entry711 = db.StringProperty(multiline=True)
    entry712 = db.StringProperty(multiline=True)
    entry713 = db.StringProperty(multiline=True)
    entry714 = db.StringProperty(multiline=True)
    entry715 = db.StringProperty(multiline=True)
    entry716 = db.StringProperty(multiline=True)
    entry717 = db.StringProperty(multiline=True)
    entry718 = db.StringProperty(multiline=True)
    entry719 = db.StringProperty(multiline=True)
    entry720 = db.StringProperty(multiline=True)
    entry721 = db.StringProperty(multiline=True)
    entry722 = db.StringProperty(multiline=True)
    entry723 = db.StringProperty(multiline=True)
    entry724 = db.StringProperty(multiline=True)
    entry725 = db.StringProperty(multiline=True)
    entry726 = db.StringProperty(multiline=True)
    entry727 = db.StringProperty(multiline=True)
    entry728 = db.StringProperty(multiline=True)
    entry729 = db.StringProperty(multiline=True)
    entry730 = db.StringProperty(multiline=True)
    entry731 = db.StringProperty(multiline=True)
    entry732 = db.StringProperty(multiline=True)
    entry733 = db.StringProperty(multiline=True)
    entry734 = db.StringProperty(multiline=True)
    entry735 = db.StringProperty(multiline=True)
    entry736 = db.StringProperty(multiline=True)
    entry737 = db.StringProperty(multiline=True)
    entry738 = db.StringProperty(multiline=True)
    entry739 = db.StringProperty(multiline=True)
    entry740 = db.StringProperty(multiline=True)
    entry741 = db.StringProperty(multiline=True)
    entry742 = db.StringProperty(multiline=True)
    entry743 = db.StringProperty(multiline=True)
    entry744 = db.StringProperty(multiline=True)
    entry745 = db.StringProperty(multiline=True)
    entry746 = db.StringProperty(multiline=True)
    entry747 = db.StringProperty(multiline=True)
    entry748 = db.StringProperty(multiline=True)
    entry749 = db.StringProperty(multiline=True)
    entry750 = db.StringProperty(multiline=True)
    entry751 = db.StringProperty(multiline=True)
    entry752 = db.StringProperty(multiline=True)
    entry753 = db.StringProperty(multiline=True)
    entry754 = db.StringProperty(multiline=True)
    entry755 = db.StringProperty(multiline=True)
    entry756 = db.StringProperty(multiline=True)
    entry757 = db.StringProperty(multiline=True)
    entry758 = db.StringProperty(multiline=True)
    entry759 = db.StringProperty(multiline=True)
    entry760 = db.StringProperty(multiline=True)
    entry761 = db.StringProperty(multiline=True)
    entry762 = db.StringProperty(multiline=True)
    entry763 = db.StringProperty(multiline=True)
    entry764 = db.StringProperty(multiline=True)
    entry765 = db.StringProperty(multiline=True)
    entry766 = db.StringProperty(multiline=True)
    entry767 = db.StringProperty(multiline=True)
    entry768 = db.StringProperty(multiline=True)
    entry769 = db.StringProperty(multiline=True)
    entry770 = db.StringProperty(multiline=True)
    entry771 = db.StringProperty(multiline=True)
    entry772 = db.StringProperty(multiline=True)
    entry773 = db.StringProperty(multiline=True)
    entry774 = db.StringProperty(multiline=True)
    entry775 = db.StringProperty(multiline=True)
    entry776 = db.StringProperty(multiline=True)
    entry777 = db.StringProperty(multiline=True)
    entry778 = db.StringProperty(multiline=True)
    entry779 = db.StringProperty(multiline=True)
    entry780 = db.StringProperty(multiline=True)
    entry781 = db.StringProperty(multiline=True)
    entry782 = db.StringProperty(multiline=True)
    entry783 = db.StringProperty(multiline=True)
    entry784 = db.StringProperty(multiline=True)
    entry785 = db.StringProperty(multiline=True)
    entry786 = db.StringProperty(multiline=True)
    entry787 = db.StringProperty(multiline=True)
    entry788 = db.StringProperty(multiline=True)
    entry789 = db.StringProperty(multiline=True)
    entry790 = db.StringProperty(multiline=True)
    entry791 = db.StringProperty(multiline=True)
    entry792 = db.StringProperty(multiline=True)
    entry793 = db.StringProperty(multiline=True)
    entry794 = db.StringProperty(multiline=True)
    entry795 = db.StringProperty(multiline=True)
    entry796 = db.StringProperty(multiline=True)
    entry797 = db.StringProperty(multiline=True)
    entry798 = db.StringProperty(multiline=True)
    entry799 = db.StringProperty(multiline=True)
    entry800 = db.StringProperty(multiline=True)
    entry801 = db.StringProperty(multiline=True)
    entry802 = db.StringProperty(multiline=True)
    entry803 = db.StringProperty(multiline=True)
    entry804 = db.StringProperty(multiline=True)
    entry805 = db.StringProperty(multiline=True)
    entry806 = db.StringProperty(multiline=True)
    entry807 = db.StringProperty(multiline=True)
    entry808 = db.StringProperty(multiline=True)
    entry809 = db.StringProperty(multiline=True)
    entry810 = db.StringProperty(multiline=True)
    entry811 = db.StringProperty(multiline=True)
    entry812 = db.StringProperty(multiline=True)
    entry813 = db.StringProperty(multiline=True)
    entry814 = db.StringProperty(multiline=True)
    entry815 = db.StringProperty(multiline=True)
    entry816 = db.StringProperty(multiline=True)
    entry817 = db.StringProperty(multiline=True)
    entry818 = db.StringProperty(multiline=True)
    entry819 = db.StringProperty(multiline=True)
    entry820 = db.StringProperty(multiline=True)
    entry821 = db.StringProperty(multiline=True)
    entry822 = db.StringProperty(multiline=True)
    entry823 = db.StringProperty(multiline=True)
    entry824 = db.StringProperty(multiline=True)
    entry825 = db.StringProperty(multiline=True)
    entry826 = db.StringProperty(multiline=True)
    entry827 = db.StringProperty(multiline=True)
    entry828 = db.StringProperty(multiline=True)
    entry829 = db.StringProperty(multiline=True)
    entry830 = db.StringProperty(multiline=True)
    entry831 = db.StringProperty(multiline=True)
    entry832 = db.StringProperty(multiline=True)
    entry833 = db.StringProperty(multiline=True)
    entry834 = db.StringProperty(multiline=True)
    entry835 = db.StringProperty(multiline=True)
    entry836 = db.StringProperty(multiline=True)
    entry837 = db.StringProperty(multiline=True)
    entry838 = db.StringProperty(multiline=True)
    entry839 = db.StringProperty(multiline=True)
    entry840 = db.StringProperty(multiline=True)
    entry841 = db.StringProperty(multiline=True)
    entry842 = db.StringProperty(multiline=True)
    entry843 = db.StringProperty(multiline=True)
    entry844 = db.StringProperty(multiline=True)
    entry845 = db.StringProperty(multiline=True)
    entry846 = db.StringProperty(multiline=True)
    entry847 = db.StringProperty(multiline=True)
    entry848 = db.StringProperty(multiline=True)
    entry849 = db.StringProperty(multiline=True)
    entry850 = db.StringProperty(multiline=True)
    entry851 = db.StringProperty(multiline=True)
    entry852 = db.StringProperty(multiline=True)
    entry853 = db.StringProperty(multiline=True)
    entry854 = db.StringProperty(multiline=True)
    entry855 = db.StringProperty(multiline=True)
    entry856 = db.StringProperty(multiline=True)
    entry857 = db.StringProperty(multiline=True)
    entry858 = db.StringProperty(multiline=True)
    entry859 = db.StringProperty(multiline=True)
    entry860 = db.StringProperty(multiline=True)
    entry861 = db.StringProperty(multiline=True)
    entry862 = db.StringProperty(multiline=True)
    entry863 = db.StringProperty(multiline=True)
    entry864 = db.StringProperty(multiline=True)
    entry865 = db.StringProperty(multiline=True)
    entry866 = db.StringProperty(multiline=True)
    entry867 = db.StringProperty(multiline=True)
    entry868 = db.StringProperty(multiline=True)
    entry869 = db.StringProperty(multiline=True)
    entry870 = db.StringProperty(multiline=True)
    entry871 = db.StringProperty(multiline=True)
    entry872 = db.StringProperty(multiline=True)
    entry873 = db.StringProperty(multiline=True)
    entry874 = db.StringProperty(multiline=True)
    entry875 = db.StringProperty(multiline=True)
    entry876 = db.StringProperty(multiline=True)
    entry877 = db.StringProperty(multiline=True)
    entry878 = db.StringProperty(multiline=True)
    entry879 = db.StringProperty(multiline=True)
    entry880 = db.StringProperty(multiline=True)
    entry881 = db.StringProperty(multiline=True)
    entry882 = db.StringProperty(multiline=True)
    entry883 = db.StringProperty(multiline=True)
    entry884 = db.StringProperty(multiline=True)
    entry885 = db.StringProperty(multiline=True)
    entry886 = db.StringProperty(multiline=True)
    entry887 = db.StringProperty(multiline=True)
    entry888 = db.StringProperty(multiline=True)
    entry889 = db.StringProperty(multiline=True)
    entry890 = db.StringProperty(multiline=True)
    entry891 = db.StringProperty(multiline=True)
    entry892 = db.StringProperty(multiline=True)
    entry893 = db.StringProperty(multiline=True)
    entry894 = db.StringProperty(multiline=True)
    entry895 = db.StringProperty(multiline=True)
    entry896 = db.StringProperty(multiline=True)
    entry897 = db.StringProperty(multiline=True)
    entry898 = db.StringProperty(multiline=True)
    entry899 = db.StringProperty(multiline=True)
    entry900 = db.StringProperty(multiline=True)
    entry901 = db.StringProperty(multiline=True)
    entry902 = db.StringProperty(multiline=True)
    entry903 = db.StringProperty(multiline=True)
    entry904 = db.StringProperty(multiline=True)
    entry905 = db.StringProperty(multiline=True)
    entry906 = db.StringProperty(multiline=True)
    entry907 = db.StringProperty(multiline=True)
    entry908 = db.StringProperty(multiline=True)
    entry909 = db.StringProperty(multiline=True)
    entry910 = db.StringProperty(multiline=True)
    entry911 = db.StringProperty(multiline=True)
    entry912 = db.StringProperty(multiline=True)
    entry913 = db.StringProperty(multiline=True)
    entry914 = db.StringProperty(multiline=True)
    entry915 = db.StringProperty(multiline=True)
    entry916 = db.StringProperty(multiline=True)
    entry917 = db.StringProperty(multiline=True)
    entry918 = db.StringProperty(multiline=True)
    entry919 = db.StringProperty(multiline=True)
    entry920 = db.StringProperty(multiline=True)
    entry921 = db.StringProperty(multiline=True)
    entry922 = db.StringProperty(multiline=True)
    entry923 = db.StringProperty(multiline=True)
    entry924 = db.StringProperty(multiline=True)
    entry925 = db.StringProperty(multiline=True)
    entry926 = db.StringProperty(multiline=True)
    entry927 = db.StringProperty(multiline=True)
    entry928 = db.StringProperty(multiline=True)
    entry929 = db.StringProperty(multiline=True)
    entry930 = db.StringProperty(multiline=True)
    entry931 = db.StringProperty(multiline=True)
    entry932 = db.StringProperty(multiline=True)
    entry933 = db.StringProperty(multiline=True)
    entry934 = db.StringProperty(multiline=True)
    entry935 = db.StringProperty(multiline=True)
    entry936 = db.StringProperty(multiline=True)
    entry937 = db.StringProperty(multiline=True)
    entry938 = db.StringProperty(multiline=True)
    entry939 = db.StringProperty(multiline=True)
    entry940 = db.StringProperty(multiline=True)
    entry941 = db.StringProperty(multiline=True)
    entry942 = db.StringProperty(multiline=True)
    entry943 = db.StringProperty(multiline=True)
    entry944 = db.StringProperty(multiline=True)
    entry945 = db.StringProperty(multiline=True)
    entry946 = db.StringProperty(multiline=True)
    entry947 = db.StringProperty(multiline=True)
    entry948 = db.StringProperty(multiline=True)
    entry949 = db.StringProperty(multiline=True)
    entry950 = db.StringProperty(multiline=True)
    entry951 = db.StringProperty(multiline=True)
    entry952 = db.StringProperty(multiline=True)
    entry953 = db.StringProperty(multiline=True)
    entry954 = db.StringProperty(multiline=True)
    entry955 = db.StringProperty(multiline=True)
    entry956 = db.StringProperty(multiline=True)
    entry957 = db.StringProperty(multiline=True)
    entry958 = db.StringProperty(multiline=True)
    entry959 = db.StringProperty(multiline=True)
    entry960 = db.StringProperty(multiline=True)
    entry961 = db.StringProperty(multiline=True)
    entry962 = db.StringProperty(multiline=True)
    entry963 = db.StringProperty(multiline=True)
    entry964 = db.StringProperty(multiline=True)
    entry965 = db.StringProperty(multiline=True)
    entry966 = db.StringProperty(multiline=True)
    entry967 = db.StringProperty(multiline=True)
    entry968 = db.StringProperty(multiline=True)
    entry969 = db.StringProperty(multiline=True)
    entry970 = db.StringProperty(multiline=True)
    entry971 = db.StringProperty(multiline=True)
    entry972 = db.StringProperty(multiline=True)
    entry973 = db.StringProperty(multiline=True)
    entry974 = db.StringProperty(multiline=True)
    entry975 = db.StringProperty(multiline=True)
    entry976 = db.StringProperty(multiline=True)
    entry977 = db.StringProperty(multiline=True)
    entry978 = db.StringProperty(multiline=True)
    entry979 = db.StringProperty(multiline=True)
    entry980 = db.StringProperty(multiline=True)
    entry981 = db.StringProperty(multiline=True)
    entry982 = db.StringProperty(multiline=True)
    entry983 = db.StringProperty(multiline=True)
    entry984 = db.StringProperty(multiline=True)
    entry985 = db.StringProperty(multiline=True)
    entry986 = db.StringProperty(multiline=True)
    entry987 = db.StringProperty(multiline=True)
    entry988 = db.StringProperty(multiline=True)
    entry989 = db.StringProperty(multiline=True)
    entry990 = db.StringProperty(multiline=True)
    entry991 = db.StringProperty(multiline=True)
    entry992 = db.StringProperty(multiline=True)
    entry993 = db.StringProperty(multiline=True)
    entry994 = db.StringProperty(multiline=True)
    entry995 = db.StringProperty(multiline=True)
    entry996 = db.StringProperty(multiline=True)
    entry997 = db.StringProperty(multiline=True)
    entry998 = db.StringProperty(multiline=True)
    entry999 = db.StringProperty(multiline=True)

この部門では優勝かな…。

これまた Google App Engine を知らないので間違ってそうですが、なんで List 使わないのかな? List にする丈けで 999 行書かずに済むんでは?

class Post(db.Model):
    user = db.UserProperty()
    ct = db.IntegerProperty()
    uid = db.StringProperty()
    indx = db.StringProperty()
    title = db.StringProperty()
    for i in range(1000):
        entry[i] = db.StringProperty(multiline=True)

List に出来るならその次に出てくる箇所も簡単になります。Browser がうまく改行しないので Comma の後に Space を挿入しましたが、

                l = ''.join([self.entry, self.entry1, self.entry2, self.entry3, self.entry4, self.entry5, self.entry6, self.entry7, self.entry8, self.entry9, self.entry10, self.entry11, self.entry12, self.entry13, self.entry14, self.entry15, self.entry16, self.entry17, self.entry18, self.entry19, self.entry20, self.entry21, self.entry22, self.entry23, self.entry24, self.entry25, self.entry26, self.entry27, self.entry28, self.entry29, self.entry30, self.entry31, self.entry32, self.entry33, self.entry34, self.entry35, self.entry36, self.entry37, self.entry38, self.entry39, self.entry40, self.entry41, self.entry42, self.entry43, self.entry44, self.entry45, self.entry46, self.entry47, self.entry48, self.entry49, self.entry50, self.entry51, self.entry52, self.entry53, self.entry54, self.entry55, self.entry56, self.entry57, self.entry58, self.entry59, self.entry60, self.entry61, self.entry62, self.entry63, self.entry64, self.entry65, self.entry66, self.entry67, self.entry68, self.entry69, self.entry70, self.entry71, self.entry72, self.entry73, self.entry74, self.entry75, self.entry76, self.entry77, self.entry78, self.entry79, self.entry80, self.entry81, self.entry82, self.entry83, self.entry84, self.entry85, self.entry86, self.entry87, self.entry88, self.entry89, self.entry90, self.entry91, self.entry92, self.entry93, self.entry94, self.entry95, self.entry96, self.entry97, self.entry98, self.entry99, self.entry100, self.entry101, self.entry102, self.entry103, self.entry104, self.entry105, self.entry106, self.entry107, self.entry108, self.entry109, self.entry110, self.entry111, self.entry112, self.entry113, self.entry114, self.entry115, self.entry116, self.entry117, self.entry118, self.entry119, self.entry120, self.entry121, self.entry122, self.entry123, self.entry124, self.entry125, self.entry126, self.entry127, self.entry128, self.entry129, self.entry130, self.entry131, self.entry132, self.entry133, self.entry134, self.entry135, self.entry136, self.entry137, self.entry138, self.entry139, self.entry140, self.entry141, self.entry142, self.entry143, self.entry144, self.entry145, self.entry146, self.entry147, self.entry148, self.entry149, self.entry150, self.entry151, self.entry152, self.entry153, self.entry154, self.entry155, self.entry156, self.entry157, self.entry158, self.entry159, self.entry160, self.entry161, self.entry162, self.entry163, self.entry164, self.entry165, self.entry166, self.entry167, self.entry168, self.entry169, self.entry170, self.entry171, self.entry172, self.entry173, self.entry174, self.entry175, self.entry176, self.entry177, self.entry178, self.entry179, self.entry180, self.entry181, self.entry182, self.entry183, self.entry184, self.entry185, self.entry186, self.entry187, self.entry188, self.entry189, self.entry190, self.entry191, self.entry192, self.entry193, self.entry194, self.entry195, self.entry196, self.entry197, self.entry198, self.entry199, self.entry200, self.entry201, self.entry202, self.entry203, self.entry204, self.entry205, self.entry206, self.entry207, self.entry208, self.entry209, self.entry210, self.entry211, self.entry212, self.entry213, self.entry214, self.entry215, self.entry216, self.entry217, self.entry218, self.entry219, self.entry220, self.entry221, self.entry222, self.entry223, self.entry224, self.entry225, self.entry226, self.entry227, self.entry228, self.entry229, self.entry230, self.entry231, self.entry232, self.entry233, self.entry234, self.entry235, self.entry236, self.entry237, self.entry238, self.entry239, self.entry240, self.entry241, self.entry242, self.entry243, self.entry244, self.entry245, self.entry246, self.entry247, self.entry248, self.entry249, self.entry250, self.entry251, self.entry252, self.entry253, self.entry254, self.entry255, self.entry256, self.entry257, self.entry258, self.entry259, self.entry260, self.entry261, self.entry262, self.entry263, self.entry264, self.entry265, self.entry266, self.entry267, self.entry268, self.entry269, self.entry270, self.entry271, self.entry272, self.entry273, self.entry274, self.entry275, self.entry276, self.entry277, self.entry278, self.entry279, self.entry280, self.entry281, self.entry282, self.entry283, self.entry284, self.entry285, self.entry286, self.entry287, self.entry288, self.entry289, self.entry290, self.entry291, self.entry292, self.entry293, self.entry294, self.entry295, self.entry296, self.entry297, self.entry298, self.entry299, self.entry300, self.entry301, self.entry302, self.entry303, self.entry304, self.entry305, self.entry306, self.entry307, self.entry308, self.entry309, self.entry310, self.entry311, self.entry312, self.entry313, self.entry314, self.entry315, self.entry316, self.entry317, self.entry318, self.entry319, self.entry320, self.entry321, self.entry322, self.entry323, self.entry324, self.entry325, self.entry326, self.entry327, self.entry328, self.entry329, self.entry330, self.entry331, self.entry332, self.entry333, self.entry334, self.entry335, self.entry336, self.entry337, self.entry338, self.entry339, self.entry340, self.entry341, self.entry342, self.entry343, self.entry344, self.entry345, self.entry346, self.entry347, self.entry348, self.entry349, self.entry350, self.entry351, self.entry352, self.entry353, self.entry354, self.entry355, self.entry356, self.entry357, self.entry358, self.entry359, self.entry360, self.entry361, self.entry362, self.entry363, self.entry364, self.entry365, self.entry366, self.entry367, self.entry368, self.entry369, self.entry370, self.entry371, self.entry372, self.entry373, self.entry374, self.entry375, self.entry376, self.entry377, self.entry378, self.entry379, self.entry380, self.entry381, self.entry382, self.entry383, self.entry384, self.entry385, self.entry386, self.entry387, self.entry388, self.entry389, self.entry390, self.entry391, self.entry392, self.entry393, self.entry394, self.entry395, self.entry396, self.entry397, self.entry398, self.entry399, self.entry400, self.entry401, self.entry402, self.entry403, self.entry404, self.entry405, self.entry406, self.entry407, self.entry408, self.entry409, self.entry410, self.entry411, self.entry412, self.entry413, self.entry414, self.entry415, self.entry416, self.entry417, self.entry418, self.entry419, self.entry420, self.entry421, self.entry422, self.entry423, self.entry424, self.entry425, self.entry426, self.entry427, self.entry428, self.entry429, self.entry430, self.entry431, self.entry432, self.entry433, self.entry434, self.entry435, self.entry436, self.entry437, self.entry438, self.entry439, self.entry440, self.entry441, self.entry442, self.entry443, self.entry444, self.entry445, self.entry446, self.entry447, self.entry448, self.entry449, self.entry450, self.entry451, self.entry452, self.entry453, self.entry454, self.entry455, self.entry456, self.entry457, self.entry458, self.entry459, self.entry460, self.entry461, self.entry462, self.entry463, self.entry464, self.entry465, self.entry466, self.entry467, self.entry468, self.entry469, self.entry470, self.entry471, self.entry472, self.entry473, self.entry474, self.entry475, self.entry476, self.entry477, self.entry478, self.entry479, self.entry480, self.entry481, self.entry482, self.entry483, self.entry484, self.entry485, self.entry486, self.entry487, self.entry488, self.entry489, self.entry490, self.entry491, self.entry492, self.entry493, self.entry494, self.entry495, self.entry496, self.entry497, self.entry498, self.entry499, self.entry500, self.entry501, self.entry502, self.entry503, self.entry504, self.entry505, self.entry506, self.entry507, self.entry508, self.entry509, self.entry510, self.entry511, self.entry512, self.entry513, self.entry514, self.entry515, self.entry516, self.entry517, self.entry518, self.entry519, self.entry520, self.entry521, self.entry522, self.entry523, self.entry524, self.entry525, self.entry526, self.entry527, self.entry528, self.entry529, self.entry530, self.entry531, self.entry532, self.entry533, self.entry534, self.entry535, self.entry536, self.entry537, self.entry538, self.entry539, self.entry540, self.entry541, self.entry542, self.entry543, self.entry544, self.entry545, self.entry546, self.entry547, self.entry548, self.entry549, self.entry550, self.entry551, self.entry552, self.entry553, self.entry554, self.entry555, self.entry556, self.entry557, self.entry558, self.entry559, self.entry560, self.entry561, self.entry562, self.entry563, self.entry564, self.entry565, self.entry566, self.entry567, self.entry568, self.entry569, self.entry570, self.entry571, self.entry572, self.entry573, self.entry574, self.entry575, self.entry576, self.entry577, self.entry578, self.entry579, self.entry580, self.entry581, self.entry582, self.entry583, self.entry584, self.entry585, self.entry586, self.entry587, self.entry588, self.entry589, self.entry590, self.entry591, self.entry592, self.entry593, self.entry594, self.entry595, self.entry596, self.entry597, self.entry598, self.entry599, self.entry600, self.entry601, self.entry602, self.entry603, self.entry604, self.entry605, self.entry606, self.entry607, self.entry608, self.entry609, self.entry610, self.entry611, self.entry612, self.entry613, self.entry614, self.entry615, self.entry616, self.entry617, self.entry618, self.entry619, self.entry620, self.entry621, self.entry622, self.entry623, self.entry624, self.entry625, self.entry626, self.entry627, self.entry628, self.entry629, self.entry630, self.entry631, self.entry632, self.entry633, self.entry634, self.entry635, self.entry636, self.entry637, self.entry638, self.entry639, self.entry640, self.entry641, self.entry642, self.entry643, self.entry644, self.entry645, self.entry646, self.entry647, self.entry648, self.entry649, self.entry650, self.entry651, self.entry652, self.entry653, self.entry654, self.entry655, self.entry656, self.entry657, self.entry658, self.entry659, self.entry660, self.entry661, self.entry662, self.entry663, self.entry664, self.entry665, self.entry666, self.entry667, self.entry668, self.entry669, self.entry670, self.entry671, self.entry672, self.entry673, self.entry674, self.entry675, self.entry676, self.entry677, self.entry678, self.entry679, self.entry680, self.entry681, self.entry682, self.entry683, self.entry684, self.entry685, self.entry686, self.entry687, self.entry688, self.entry689, self.entry690, self.entry691, self.entry692, self.entry693, self.entry694, self.entry695, self.entry696, self.entry697, self.entry698, self.entry699, self.entry700, self.entry701, self.entry702, self.entry703, self.entry704, self.entry705, self.entry706, self.entry707, self.entry708, self.entry709, self.entry710, self.entry711, self.entry712, self.entry713, self.entry714, self.entry715, self.entry716, self.entry717, self.entry718, self.entry719, self.entry720, self.entry721, self.entry722, self.entry723, self.entry724, self.entry725, self.entry726, self.entry727, self.entry728, self.entry729, self.entry730, self.entry731, self.entry732, self.entry733, self.entry734, self.entry735, self.entry736, self.entry737, self.entry738, self.entry739, self.entry740, self.entry741, self.entry742, self.entry743, self.entry744, self.entry745, self.entry746, self.entry747, self.entry748, self.entry749, self.entry750, self.entry751, self.entry752, self.entry753, self.entry754, self.entry755, self.entry756, self.entry757, self.entry758, self.entry759, self.entry760, self.entry761, self.entry762, self.entry763, self.entry764, self.entry765, self.entry766, self.entry767, self.entry768, self.entry769, self.entry770, self.entry771, self.entry772, self.entry773, self.entry774, self.entry775, self.entry776, self.entry777, self.entry778, self.entry779, self.entry780, self.entry781, self.entry782, self.entry783, self.entry784, self.entry785, self.entry786, self.entry787, self.entry788, self.entry789, self.entry790, self.entry791, self.entry792, self.entry793, self.entry794, self.entry795, self.entry796, self.entry797, self.entry798, self.entry799, self.entry800, self.entry801, self.entry802, self.entry803, self.entry804, self.entry805, self.entry806, self.entry807, self.entry808, self.entry809, self.entry810, self.entry811, self.entry812, self.entry813, self.entry814, self.entry815, self.entry816, self.entry817, self.entry818, self.entry819, self.entry820, self.entry821, self.entry822, self.entry823, self.entry824, self.entry825, self.entry826, self.entry827, self.entry828, self.entry829, self.entry830, self.entry831, self.entry832, self.entry833, self.entry834, self.entry835, self.entry836, self.entry837, self.entry838, self.entry839, self.entry840, self.entry841, self.entry842, self.entry843, self.entry844, self.entry845, self.entry846, self.entry847, self.entry848, self.entry849, self.entry850, self.entry851, self.entry852, self.entry853, self.entry854, self.entry855, self.entry856, self.entry857, self.entry858, self.entry859, self.entry860, self.entry861, self.entry862, self.entry863, self.entry864, self.entry865, self.entry866, self.entry867, self.entry868, self.entry869, self.entry870, self.entry871, self.entry872, self.entry873, self.entry874, self.entry875, self.entry876, self.entry877, self.entry878, self.entry879, self.entry880, self.entry881, self.entry882, self.entry883, self.entry884, self.entry885, self.entry886, self.entry887, self.entry888, self.entry889, self.entry890, self.entry891, self.entry892, self.entry893, self.entry894, self.entry895, self.entry896, self.entry897, self.entry898, self.entry899, self.entry900, self.entry901, self.entry902, self.entry903, self.entry904, self.entry905, self.entry906, self.entry907, self.entry908, self.entry909, self.entry910, self.entry911, self.entry912, self.entry913, self.entry914, self.entry915, self.entry916, self.entry917, self.entry918, self.entry919, self.entry920, self.entry921, self.entry922, self.entry923, self.entry924, self.entry925, self.entry926, self.entry927, self.entry928, self.entry929, self.entry930, self.entry931, self.entry932, self.entry933, self.entry934, self.entry935, self.entry936, self.entry937, self.entry938, self.entry939, self.entry940, self.entry941, self.entry942, self.entry943, self.entry944, self.entry945, self.entry946, self.entry947, self.entry948, self.entry949, self.entry950, self.entry951, self.entry952, self.entry953, self.entry954, self.entry955, self.entry956, self.entry957, self.entry958, self.entry959, self.entry960, self.entry961, self.entry962, self.entry963, self.entry964, self.entry965, self.entry966, self.entry967, self.entry968, self.entry969, self.entry970, self.entry971, self.entry972, self.entry973, self.entry974, self.entry975, self.entry976, self.entry977, self.entry978, self.entry979, self.entry980, self.entry981, self.entry982, self.entry983, self.entry984, self.entry985, self.entry986, self.entry987, self.entry988, self.entry989, self.entry990, self.entry991, self.entry992, self.entry993, self.entry994, self.entry995, self.entry996, self.entry997, self.entry998, self.entry999])

正直どうなんでしょう? こういうの書いてて嫌にならないのかな? List にすると…

                l = ''.join(self.entry)

そして、File の終端間際にもう一度念を押してくる(w

                self.entry = x[:500]
                self.entry1 = x[500:1000]
                self.entry2 = x[1000:1500]
                self.entry3 = x[1500:2000]
                self.entry4 = x[2000:2500]
                self.entry5 = x[2500:3000]
                self.entry6 = x[3000:3500]
                self.entry7 = x[3500:4000]
                self.entry8 = x[4000:4500]
                self.entry9 = x[4500:5000]
                self.entry10 = x[5000:5500]
                self.entry11 = x[5500:6000]
                self.entry12 = x[6000:6500]
                self.entry13 = x[6500:7000]
                self.entry14 = x[7000:7500]
                self.entry15 = x[7500:8000]
                self.entry16 = x[8000:8500]
                self.entry17 = x[8500:9000]
                self.entry18 = x[9000:9500]
                self.entry19 = x[9500:10000]
                self.entry20 = x[10000:10500]
                self.entry21 = x[10500:11000]
                self.entry22 = x[11000:11500]
                self.entry23 = x[11500:12000]
                self.entry24 = x[12000:12500]
                self.entry25 = x[12500:13000]
                self.entry26 = x[13000:13500]
                self.entry27 = x[13500:14000]
                self.entry28 = x[14000:14500]
                self.entry29 = x[14500:15000]
                self.entry30 = x[15000:15500]
                self.entry31 = x[15500:16000]
                self.entry32 = x[16000:16500]
                self.entry33 = x[16500:17000]
                self.entry34 = x[17000:17500]
                self.entry35 = x[17500:18000]
                self.entry36 = x[18000:18500]
                self.entry37 = x[18500:19000]
                self.entry38 = x[19000:19500]
                self.entry39 = x[19500:20000]
                self.entry40 = x[20000:20500]
                self.entry41 = x[20500:21000]
                self.entry42 = x[21000:21500]
                self.entry43 = x[21500:22000]
                self.entry44 = x[22000:22500]
                self.entry45 = x[22500:23000]
                self.entry46 = x[23000:23500]
                self.entry47 = x[23500:24000]
                self.entry48 = x[24000:24500]
                self.entry49 = x[24500:25000]
                self.entry50 = x[25000:25500]
                self.entry51 = x[25500:26000]
                self.entry52 = x[26000:26500]
                self.entry53 = x[26500:27000]
                self.entry54 = x[27000:27500]
                self.entry55 = x[27500:28000]
                self.entry56 = x[28000:28500]
                self.entry57 = x[28500:29000]
                self.entry58 = x[29000:29500]
                self.entry59 = x[29500:30000]
                self.entry60 = x[30000:30500]
                self.entry61 = x[30500:31000]
                self.entry62 = x[31000:31500]
                self.entry63 = x[31500:32000]
                self.entry64 = x[32000:32500]
                self.entry65 = x[32500:33000]
                self.entry66 = x[33000:33500]
                self.entry67 = x[33500:34000]
                self.entry68 = x[34000:34500]
                self.entry69 = x[34500:35000]
                self.entry70 = x[35000:35500]
                self.entry71 = x[35500:36000]
                self.entry72 = x[36000:36500]
                self.entry73 = x[36500:37000]
                self.entry74 = x[37000:37500]
                self.entry75 = x[37500:38000]
                self.entry76 = x[38000:38500]
                self.entry77 = x[38500:39000]
                self.entry78 = x[39000:39500]
                self.entry79 = x[39500:40000]
                self.entry80 = x[40000:40500]
                self.entry81 = x[40500:41000]
                self.entry82 = x[41000:41500]
                self.entry83 = x[41500:42000]
                self.entry84 = x[42000:42500]
                self.entry85 = x[42500:43000]
                self.entry86 = x[43000:43500]
                self.entry87 = x[43500:44000]
                self.entry88 = x[44000:44500]
                self.entry89 = x[44500:45000]
                self.entry90 = x[45000:45500]
                self.entry91 = x[45500:46000]
                self.entry92 = x[46000:46500]
                self.entry93 = x[46500:47000]
                self.entry94 = x[47000:47500]
                self.entry95 = x[47500:48000]
                self.entry96 = x[48000:48500]
                self.entry97 = x[48500:49000]
                self.entry98 = x[49000:49500]
                self.entry99 = x[49500:50000]
                self.entry100 = x[50000:50500]
                self.entry101 = x[50500:51000]
                self.entry102 = x[51000:51500]
                self.entry103 = x[51500:52000]
                self.entry104 = x[52000:52500]
                self.entry105 = x[52500:53000]
                self.entry106 = x[53000:53500]
                self.entry107 = x[53500:54000]
                self.entry108 = x[54000:54500]
                self.entry109 = x[54500:55000]
                self.entry110 = x[55000:55500]
                self.entry111 = x[55500:56000]
                self.entry112 = x[56000:56500]
                self.entry113 = x[56500:57000]
                self.entry114 = x[57000:57500]
                self.entry115 = x[57500:58000]
                self.entry116 = x[58000:58500]
                self.entry117 = x[58500:59000]
                self.entry118 = x[59000:59500]
                self.entry119 = x[59500:60000]
                self.entry120 = x[60000:60500]
                self.entry121 = x[60500:61000]
                self.entry122 = x[61000:61500]
                self.entry123 = x[61500:62000]
                self.entry124 = x[62000:62500]
                self.entry125 = x[62500:63000]
                self.entry126 = x[63000:63500]
                self.entry127 = x[63500:64000]
                self.entry128 = x[64000:64500]
                self.entry129 = x[64500:65000]
                self.entry130 = x[65000:65500]
                self.entry131 = x[65500:66000]
                self.entry132 = x[66000:66500]
                self.entry133 = x[66500:67000]
                self.entry134 = x[67000:67500]
                self.entry135 = x[67500:68000]
                self.entry136 = x[68000:68500]
                self.entry137 = x[68500:69000]
                self.entry138 = x[69000:69500]
                self.entry139 = x[69500:70000]
                self.entry140 = x[70000:70500]
                self.entry141 = x[70500:71000]
                self.entry142 = x[71000:71500]
                self.entry143 = x[71500:72000]
                self.entry144 = x[72000:72500]
                self.entry145 = x[72500:73000]
                self.entry146 = x[73000:73500]
                self.entry147 = x[73500:74000]
                self.entry148 = x[74000:74500]
                self.entry149 = x[74500:75000]
                self.entry150 = x[75000:75500]
                self.entry151 = x[75500:76000]
                self.entry152 = x[76000:76500]
                self.entry153 = x[76500:77000]
                self.entry154 = x[77000:77500]
                self.entry155 = x[77500:78000]
                self.entry156 = x[78000:78500]
                self.entry157 = x[78500:79000]
                self.entry158 = x[79000:79500]
                self.entry159 = x[79500:80000]
                self.entry160 = x[80000:80500]
                self.entry161 = x[80500:81000]
                self.entry162 = x[81000:81500]
                self.entry163 = x[81500:82000]
                self.entry164 = x[82000:82500]
                self.entry165 = x[82500:83000]
                self.entry166 = x[83000:83500]
                self.entry167 = x[83500:84000]
                self.entry168 = x[84000:84500]
                self.entry169 = x[84500:85000]
                self.entry170 = x[85000:85500]
                self.entry171 = x[85500:86000]
                self.entry172 = x[86000:86500]
                self.entry173 = x[86500:87000]
                self.entry174 = x[87000:87500]
                self.entry175 = x[87500:88000]
                self.entry176 = x[88000:88500]
                self.entry177 = x[88500:89000]
                self.entry178 = x[89000:89500]
                self.entry179 = x[89500:90000]
                self.entry180 = x[90000:90500]
                self.entry181 = x[90500:91000]
                self.entry182 = x[91000:91500]
                self.entry183 = x[91500:92000]
                self.entry184 = x[92000:92500]
                self.entry185 = x[92500:93000]
                self.entry186 = x[93000:93500]
                self.entry187 = x[93500:94000]
                self.entry188 = x[94000:94500]
                self.entry189 = x[94500:95000]
                self.entry190 = x[95000:95500]
                self.entry191 = x[95500:96000]
                self.entry192 = x[96000:96500]
                self.entry193 = x[96500:97000]
                self.entry194 = x[97000:97500]
                self.entry195 = x[97500:98000]
                self.entry196 = x[98000:98500]
                self.entry197 = x[98500:99000]
                self.entry198 = x[99000:99500]
                self.entry199 = x[99500:100000]
                self.entry200 = x[100000:100500]
                self.entry201 = x[100500:101000]
                self.entry202 = x[101000:101500]
                self.entry203 = x[101500:102000]
                self.entry204 = x[102000:102500]
                self.entry205 = x[102500:103000]
                self.entry206 = x[103000:103500]
                self.entry207 = x[103500:104000]
                self.entry208 = x[104000:104500]
                self.entry209 = x[104500:105000]
                self.entry210 = x[105000:105500]
                self.entry211 = x[105500:106000]
                self.entry212 = x[106000:106500]
                self.entry213 = x[106500:107000]
                self.entry214 = x[107000:107500]
                self.entry215 = x[107500:108000]
                self.entry216 = x[108000:108500]
                self.entry217 = x[108500:109000]
                self.entry218 = x[109000:109500]
                self.entry219 = x[109500:110000]
                self.entry220 = x[110000:110500]
                self.entry221 = x[110500:111000]
                self.entry222 = x[111000:111500]
                self.entry223 = x[111500:112000]
                self.entry224 = x[112000:112500]
                self.entry225 = x[112500:113000]
                self.entry226 = x[113000:113500]
                self.entry227 = x[113500:114000]
                self.entry228 = x[114000:114500]
                self.entry229 = x[114500:115000]
                self.entry230 = x[115000:115500]
                self.entry231 = x[115500:116000]
                self.entry232 = x[116000:116500]
                self.entry233 = x[116500:117000]
                self.entry234 = x[117000:117500]
                self.entry235 = x[117500:118000]
                self.entry236 = x[118000:118500]
                self.entry237 = x[118500:119000]
                self.entry238 = x[119000:119500]
                self.entry239 = x[119500:120000]
                self.entry240 = x[120000:120500]
                self.entry241 = x[120500:121000]
                self.entry242 = x[121000:121500]
                self.entry243 = x[121500:122000]
                self.entry244 = x[122000:122500]
                self.entry245 = x[122500:123000]
                self.entry246 = x[123000:123500]
                self.entry247 = x[123500:124000]
                self.entry248 = x[124000:124500]
                self.entry249 = x[124500:125000]
                self.entry250 = x[125000:125500]
                self.entry251 = x[125500:126000]
                self.entry252 = x[126000:126500]
                self.entry253 = x[126500:127000]
                self.entry254 = x[127000:127500]
                self.entry255 = x[127500:128000]
                self.entry256 = x[128000:128500]
                self.entry257 = x[128500:129000]
                self.entry258 = x[129000:129500]
                self.entry259 = x[129500:130000]
                self.entry260 = x[130000:130500]
                self.entry261 = x[130500:131000]
                self.entry262 = x[131000:131500]
                self.entry263 = x[131500:132000]
                self.entry264 = x[132000:132500]
                self.entry265 = x[132500:133000]
                self.entry266 = x[133000:133500]
                self.entry267 = x[133500:134000]
                self.entry268 = x[134000:134500]
                self.entry269 = x[134500:135000]
                self.entry270 = x[135000:135500]
                self.entry271 = x[135500:136000]
                self.entry272 = x[136000:136500]
                self.entry273 = x[136500:137000]
                self.entry274 = x[137000:137500]
                self.entry275 = x[137500:138000]
                self.entry276 = x[138000:138500]
                self.entry277 = x[138500:139000]
                self.entry278 = x[139000:139500]
                self.entry279 = x[139500:140000]
                self.entry280 = x[140000:140500]
                self.entry281 = x[140500:141000]
                self.entry282 = x[141000:141500]
                self.entry283 = x[141500:142000]
                self.entry284 = x[142000:142500]
                self.entry285 = x[142500:143000]
                self.entry286 = x[143000:143500]
                self.entry287 = x[143500:144000]
                self.entry288 = x[144000:144500]
                self.entry289 = x[144500:145000]
                self.entry290 = x[145000:145500]
                self.entry291 = x[145500:146000]
                self.entry292 = x[146000:146500]
                self.entry293 = x[146500:147000]
                self.entry294 = x[147000:147500]
                self.entry295 = x[147500:148000]
                self.entry296 = x[148000:148500]
                self.entry297 = x[148500:149000]
                self.entry298 = x[149000:149500]
                self.entry299 = x[149500:150000]
                self.entry300 = x[150000:150500]
                self.entry301 = x[150500:151000]
                self.entry302 = x[151000:151500]
                self.entry303 = x[151500:152000]
                self.entry304 = x[152000:152500]
                self.entry305 = x[152500:153000]
                self.entry306 = x[153000:153500]
                self.entry307 = x[153500:154000]
                self.entry308 = x[154000:154500]
                self.entry309 = x[154500:155000]
                self.entry310 = x[155000:155500]
                self.entry311 = x[155500:156000]
                self.entry312 = x[156000:156500]
                self.entry313 = x[156500:157000]
                self.entry314 = x[157000:157500]
                self.entry315 = x[157500:158000]
                self.entry316 = x[158000:158500]
                self.entry317 = x[158500:159000]
                self.entry318 = x[159000:159500]
                self.entry319 = x[159500:160000]
                self.entry320 = x[160000:160500]
                self.entry321 = x[160500:161000]
                self.entry322 = x[161000:161500]
                self.entry323 = x[161500:162000]
                self.entry324 = x[162000:162500]
                self.entry325 = x[162500:163000]
                self.entry326 = x[163000:163500]
                self.entry327 = x[163500:164000]
                self.entry328 = x[164000:164500]
                self.entry329 = x[164500:165000]
                self.entry330 = x[165000:165500]
                self.entry331 = x[165500:166000]
                self.entry332 = x[166000:166500]
                self.entry333 = x[166500:167000]
                self.entry334 = x[167000:167500]
                self.entry335 = x[167500:168000]
                self.entry336 = x[168000:168500]
                self.entry337 = x[168500:169000]
                self.entry338 = x[169000:169500]
                self.entry339 = x[169500:170000]
                self.entry340 = x[170000:170500]
                self.entry341 = x[170500:171000]
                self.entry342 = x[171000:171500]
                self.entry343 = x[171500:172000]
                self.entry344 = x[172000:172500]
                self.entry345 = x[172500:173000]
                self.entry346 = x[173000:173500]
                self.entry347 = x[173500:174000]
                self.entry348 = x[174000:174500]
                self.entry349 = x[174500:175000]
                self.entry350 = x[175000:175500]
                self.entry351 = x[175500:176000]
                self.entry352 = x[176000:176500]
                self.entry353 = x[176500:177000]
                self.entry354 = x[177000:177500]
                self.entry355 = x[177500:178000]
                self.entry356 = x[178000:178500]
                self.entry357 = x[178500:179000]
                self.entry358 = x[179000:179500]
                self.entry359 = x[179500:180000]
                self.entry360 = x[180000:180500]
                self.entry361 = x[180500:181000]
                self.entry362 = x[181000:181500]
                self.entry363 = x[181500:182000]
                self.entry364 = x[182000:182500]
                self.entry365 = x[182500:183000]
                self.entry366 = x[183000:183500]
                self.entry367 = x[183500:184000]
                self.entry368 = x[184000:184500]
                self.entry369 = x[184500:185000]
                self.entry370 = x[185000:185500]
                self.entry371 = x[185500:186000]
                self.entry372 = x[186000:186500]
                self.entry373 = x[186500:187000]
                self.entry374 = x[187000:187500]
                self.entry375 = x[187500:188000]
                self.entry376 = x[188000:188500]
                self.entry377 = x[188500:189000]
                self.entry378 = x[189000:189500]
                self.entry379 = x[189500:190000]
                self.entry380 = x[190000:190500]
                self.entry381 = x[190500:191000]
                self.entry382 = x[191000:191500]
                self.entry383 = x[191500:192000]
                self.entry384 = x[192000:192500]
                self.entry385 = x[192500:193000]
                self.entry386 = x[193000:193500]
                self.entry387 = x[193500:194000]
                self.entry388 = x[194000:194500]
                self.entry389 = x[194500:195000]
                self.entry390 = x[195000:195500]
                self.entry391 = x[195500:196000]
                self.entry392 = x[196000:196500]
                self.entry393 = x[196500:197000]
                self.entry394 = x[197000:197500]
                self.entry395 = x[197500:198000]
                self.entry396 = x[198000:198500]
                self.entry397 = x[198500:199000]
                self.entry398 = x[199000:199500]
                self.entry399 = x[199500:200000]
                self.entry400 = x[200000:200500]
                self.entry401 = x[200500:201000]
                self.entry402 = x[201000:201500]
                self.entry403 = x[201500:202000]
                self.entry404 = x[202000:202500]
                self.entry405 = x[202500:203000]
                self.entry406 = x[203000:203500]
                self.entry407 = x[203500:204000]
                self.entry408 = x[204000:204500]
                self.entry409 = x[204500:205000]
                self.entry410 = x[205000:205500]
                self.entry411 = x[205500:206000]
                self.entry412 = x[206000:206500]
                self.entry413 = x[206500:207000]
                self.entry414 = x[207000:207500]
                self.entry415 = x[207500:208000]
                self.entry416 = x[208000:208500]
                self.entry417 = x[208500:209000]
                self.entry418 = x[209000:209500]
                self.entry419 = x[209500:210000]
                self.entry420 = x[210000:210500]
                self.entry421 = x[210500:211000]
                self.entry422 = x[211000:211500]
                self.entry423 = x[211500:212000]
                self.entry424 = x[212000:212500]
                self.entry425 = x[212500:213000]
                self.entry426 = x[213000:213500]
                self.entry427 = x[213500:214000]
                self.entry428 = x[214000:214500]
                self.entry429 = x[214500:215000]
                self.entry430 = x[215000:215500]
                self.entry431 = x[215500:216000]
                self.entry432 = x[216000:216500]
                self.entry433 = x[216500:217000]
                self.entry434 = x[217000:217500]
                self.entry435 = x[217500:218000]
                self.entry436 = x[218000:218500]
                self.entry437 = x[218500:219000]
                self.entry438 = x[219000:219500]
                self.entry439 = x[219500:220000]
                self.entry440 = x[220000:220500]
                self.entry441 = x[220500:221000]
                self.entry442 = x[221000:221500]
                self.entry443 = x[221500:222000]
                self.entry444 = x[222000:222500]
                self.entry445 = x[222500:223000]
                self.entry446 = x[223000:223500]
                self.entry447 = x[223500:224000]
                self.entry448 = x[224000:224500]
                self.entry449 = x[224500:225000]
                self.entry450 = x[225000:225500]
                self.entry451 = x[225500:226000]
                self.entry452 = x[226000:226500]
                self.entry453 = x[226500:227000]
                self.entry454 = x[227000:227500]
                self.entry455 = x[227500:228000]
                self.entry456 = x[228000:228500]
                self.entry457 = x[228500:229000]
                self.entry458 = x[229000:229500]
                self.entry459 = x[229500:230000]
                self.entry460 = x[230000:230500]
                self.entry461 = x[230500:231000]
                self.entry462 = x[231000:231500]
                self.entry463 = x[231500:232000]
                self.entry464 = x[232000:232500]
                self.entry465 = x[232500:233000]
                self.entry466 = x[233000:233500]
                self.entry467 = x[233500:234000]
                self.entry468 = x[234000:234500]
                self.entry469 = x[234500:235000]
                self.entry470 = x[235000:235500]
                self.entry471 = x[235500:236000]
                self.entry472 = x[236000:236500]
                self.entry473 = x[236500:237000]
                self.entry474 = x[237000:237500]
                self.entry475 = x[237500:238000]
                self.entry476 = x[238000:238500]
                self.entry477 = x[238500:239000]
                self.entry478 = x[239000:239500]
                self.entry479 = x[239500:240000]
                self.entry480 = x[240000:240500]
                self.entry481 = x[240500:241000]
                self.entry482 = x[241000:241500]
                self.entry483 = x[241500:242000]
                self.entry484 = x[242000:242500]
                self.entry485 = x[242500:243000]
                self.entry486 = x[243000:243500]
                self.entry487 = x[243500:244000]
                self.entry488 = x[244000:244500]
                self.entry489 = x[244500:245000]
                self.entry490 = x[245000:245500]
                self.entry491 = x[245500:246000]
                self.entry492 = x[246000:246500]
                self.entry493 = x[246500:247000]
                self.entry494 = x[247000:247500]
                self.entry495 = x[247500:248000]
                self.entry496 = x[248000:248500]
                self.entry497 = x[248500:249000]
                self.entry498 = x[249000:249500]
                self.entry499 = x[249500:250000]
                self.entry500 = x[250000:250500]
                self.entry501 = x[250500:251000]
                self.entry502 = x[251000:251500]
                self.entry503 = x[251500:252000]
                self.entry504 = x[252000:252500]
                self.entry505 = x[252500:253000]
                self.entry506 = x[253000:253500]
                self.entry507 = x[253500:254000]
                self.entry508 = x[254000:254500]
                self.entry509 = x[254500:255000]
                self.entry510 = x[255000:255500]
                self.entry511 = x[255500:256000]
                self.entry512 = x[256000:256500]
                self.entry513 = x[256500:257000]
                self.entry514 = x[257000:257500]
                self.entry515 = x[257500:258000]
                self.entry516 = x[258000:258500]
                self.entry517 = x[258500:259000]
                self.entry518 = x[259000:259500]
                self.entry519 = x[259500:260000]
                self.entry520 = x[260000:260500]
                self.entry521 = x[260500:261000]
                self.entry522 = x[261000:261500]
                self.entry523 = x[261500:262000]
                self.entry524 = x[262000:262500]
                self.entry525 = x[262500:263000]
                self.entry526 = x[263000:263500]
                self.entry527 = x[263500:264000]
                self.entry528 = x[264000:264500]
                self.entry529 = x[264500:265000]
                self.entry530 = x[265000:265500]
                self.entry531 = x[265500:266000]
                self.entry532 = x[266000:266500]
                self.entry533 = x[266500:267000]
                self.entry534 = x[267000:267500]
                self.entry535 = x[267500:268000]
                self.entry536 = x[268000:268500]
                self.entry537 = x[268500:269000]
                self.entry538 = x[269000:269500]
                self.entry539 = x[269500:270000]
                self.entry540 = x[270000:270500]
                self.entry541 = x[270500:271000]
                self.entry542 = x[271000:271500]
                self.entry543 = x[271500:272000]
                self.entry544 = x[272000:272500]
                self.entry545 = x[272500:273000]
                self.entry546 = x[273000:273500]
                self.entry547 = x[273500:274000]
                self.entry548 = x[274000:274500]
                self.entry549 = x[274500:275000]
                self.entry550 = x[275000:275500]
                self.entry551 = x[275500:276000]
                self.entry552 = x[276000:276500]
                self.entry553 = x[276500:277000]
                self.entry554 = x[277000:277500]
                self.entry555 = x[277500:278000]
                self.entry556 = x[278000:278500]
                self.entry557 = x[278500:279000]
                self.entry558 = x[279000:279500]
                self.entry559 = x[279500:280000]
                self.entry560 = x[280000:280500]
                self.entry561 = x[280500:281000]
                self.entry562 = x[281000:281500]
                self.entry563 = x[281500:282000]
                self.entry564 = x[282000:282500]
                self.entry565 = x[282500:283000]
                self.entry566 = x[283000:283500]
                self.entry567 = x[283500:284000]
                self.entry568 = x[284000:284500]
                self.entry569 = x[284500:285000]
                self.entry570 = x[285000:285500]
                self.entry571 = x[285500:286000]
                self.entry572 = x[286000:286500]
                self.entry573 = x[286500:287000]
                self.entry574 = x[287000:287500]
                self.entry575 = x[287500:288000]
                self.entry576 = x[288000:288500]
                self.entry577 = x[288500:289000]
                self.entry578 = x[289000:289500]
                self.entry579 = x[289500:290000]
                self.entry580 = x[290000:290500]
                self.entry581 = x[290500:291000]
                self.entry582 = x[291000:291500]
                self.entry583 = x[291500:292000]
                self.entry584 = x[292000:292500]
                self.entry585 = x[292500:293000]
                self.entry586 = x[293000:293500]
                self.entry587 = x[293500:294000]
                self.entry588 = x[294000:294500]
                self.entry589 = x[294500:295000]
                self.entry590 = x[295000:295500]
                self.entry591 = x[295500:296000]
                self.entry592 = x[296000:296500]
                self.entry593 = x[296500:297000]
                self.entry594 = x[297000:297500]
                self.entry595 = x[297500:298000]
                self.entry596 = x[298000:298500]
                self.entry597 = x[298500:299000]
                self.entry598 = x[299000:299500]
                self.entry599 = x[299500:300000]
                self.entry600 = x[300000:300500]
                self.entry601 = x[300500:301000]
                self.entry602 = x[301000:301500]
                self.entry603 = x[301500:302000]
                self.entry604 = x[302000:302500]
                self.entry605 = x[302500:303000]
                self.entry606 = x[303000:303500]
                self.entry607 = x[303500:304000]
                self.entry608 = x[304000:304500]
                self.entry609 = x[304500:305000]
                self.entry610 = x[305000:305500]
                self.entry611 = x[305500:306000]
                self.entry612 = x[306000:306500]
                self.entry613 = x[306500:307000]
                self.entry614 = x[307000:307500]
                self.entry615 = x[307500:308000]
                self.entry616 = x[308000:308500]
                self.entry617 = x[308500:309000]
                self.entry618 = x[309000:309500]
                self.entry619 = x[309500:310000]
                self.entry620 = x[310000:310500]
                self.entry621 = x[310500:311000]
                self.entry622 = x[311000:311500]
                self.entry623 = x[311500:312000]
                self.entry624 = x[312000:312500]
                self.entry625 = x[312500:313000]
                self.entry626 = x[313000:313500]
                self.entry627 = x[313500:314000]
                self.entry628 = x[314000:314500]
                self.entry629 = x[314500:315000]
                self.entry630 = x[315000:315500]
                self.entry631 = x[315500:316000]
                self.entry632 = x[316000:316500]
                self.entry633 = x[316500:317000]
                self.entry634 = x[317000:317500]
                self.entry635 = x[317500:318000]
                self.entry636 = x[318000:318500]
                self.entry637 = x[318500:319000]
                self.entry638 = x[319000:319500]
                self.entry639 = x[319500:320000]
                self.entry640 = x[320000:320500]
                self.entry641 = x[320500:321000]
                self.entry642 = x[321000:321500]
                self.entry643 = x[321500:322000]
                self.entry644 = x[322000:322500]
                self.entry645 = x[322500:323000]
                self.entry646 = x[323000:323500]
                self.entry647 = x[323500:324000]
                self.entry648 = x[324000:324500]
                self.entry649 = x[324500:325000]
                self.entry650 = x[325000:325500]
                self.entry651 = x[325500:326000]
                self.entry652 = x[326000:326500]
                self.entry653 = x[326500:327000]
                self.entry654 = x[327000:327500]
                self.entry655 = x[327500:328000]
                self.entry656 = x[328000:328500]
                self.entry657 = x[328500:329000]
                self.entry658 = x[329000:329500]
                self.entry659 = x[329500:330000]
                self.entry660 = x[330000:330500]
                self.entry661 = x[330500:331000]
                self.entry662 = x[331000:331500]
                self.entry663 = x[331500:332000]
                self.entry664 = x[332000:332500]
                self.entry665 = x[332500:333000]
                self.entry666 = x[333000:333500]
                self.entry667 = x[333500:334000]
                self.entry668 = x[334000:334500]
                self.entry669 = x[334500:335000]
                self.entry670 = x[335000:335500]
                self.entry671 = x[335500:336000]
                self.entry672 = x[336000:336500]
                self.entry673 = x[336500:337000]
                self.entry674 = x[337000:337500]
                self.entry675 = x[337500:338000]
                self.entry676 = x[338000:338500]
                self.entry677 = x[338500:339000]
                self.entry678 = x[339000:339500]
                self.entry679 = x[339500:340000]
                self.entry680 = x[340000:340500]
                self.entry681 = x[340500:341000]
                self.entry682 = x[341000:341500]
                self.entry683 = x[341500:342000]
                self.entry684 = x[342000:342500]
                self.entry685 = x[342500:343000]
                self.entry686 = x[343000:343500]
                self.entry687 = x[343500:344000]
                self.entry688 = x[344000:344500]
                self.entry689 = x[344500:345000]
                self.entry690 = x[345000:345500]
                self.entry691 = x[345500:346000]
                self.entry692 = x[346000:346500]
                self.entry693 = x[346500:347000]
                self.entry694 = x[347000:347500]
                self.entry695 = x[347500:348000]
                self.entry696 = x[348000:348500]
                self.entry697 = x[348500:349000]
                self.entry698 = x[349000:349500]
                self.entry699 = x[349500:350000]
                self.entry700 = x[350000:350500]
                self.entry701 = x[350500:351000]
                self.entry702 = x[351000:351500]
                self.entry703 = x[351500:352000]
                self.entry704 = x[352000:352500]
                self.entry705 = x[352500:353000]
                self.entry706 = x[353000:353500]
                self.entry707 = x[353500:354000]
                self.entry708 = x[354000:354500]
                self.entry709 = x[354500:355000]
                self.entry710 = x[355000:355500]
                self.entry711 = x[355500:356000]
                self.entry712 = x[356000:356500]
                self.entry713 = x[356500:357000]
                self.entry714 = x[357000:357500]
                self.entry715 = x[357500:358000]
                self.entry716 = x[358000:358500]
                self.entry717 = x[358500:359000]
                self.entry718 = x[359000:359500]
                self.entry719 = x[359500:360000]
                self.entry720 = x[360000:360500]
                self.entry721 = x[360500:361000]
                self.entry722 = x[361000:361500]
                self.entry723 = x[361500:362000]
                self.entry724 = x[362000:362500]
                self.entry725 = x[362500:363000]
                self.entry726 = x[363000:363500]
                self.entry727 = x[363500:364000]
                self.entry728 = x[364000:364500]
                self.entry729 = x[364500:365000]
                self.entry730 = x[365000:365500]
                self.entry731 = x[365500:366000]
                self.entry732 = x[366000:366500]
                self.entry733 = x[366500:367000]
                self.entry734 = x[367000:367500]
                self.entry735 = x[367500:368000]
                self.entry736 = x[368000:368500]
                self.entry737 = x[368500:369000]
                self.entry738 = x[369000:369500]
                self.entry739 = x[369500:370000]
                self.entry740 = x[370000:370500]
                self.entry741 = x[370500:371000]
                self.entry742 = x[371000:371500]
                self.entry743 = x[371500:372000]
                self.entry744 = x[372000:372500]
                self.entry745 = x[372500:373000]
                self.entry746 = x[373000:373500]
                self.entry747 = x[373500:374000]
                self.entry748 = x[374000:374500]
                self.entry749 = x[374500:375000]
                self.entry750 = x[375000:375500]
                self.entry751 = x[375500:376000]
                self.entry752 = x[376000:376500]
                self.entry753 = x[376500:377000]
                self.entry754 = x[377000:377500]
                self.entry755 = x[377500:378000]
                self.entry756 = x[378000:378500]
                self.entry757 = x[378500:379000]
                self.entry758 = x[379000:379500]
                self.entry759 = x[379500:380000]
                self.entry760 = x[380000:380500]
                self.entry761 = x[380500:381000]
                self.entry762 = x[381000:381500]
                self.entry763 = x[381500:382000]
                self.entry764 = x[382000:382500]
                self.entry765 = x[382500:383000]
                self.entry766 = x[383000:383500]
                self.entry767 = x[383500:384000]
                self.entry768 = x[384000:384500]
                self.entry769 = x[384500:385000]
                self.entry770 = x[385000:385500]
                self.entry771 = x[385500:386000]
                self.entry772 = x[386000:386500]
                self.entry773 = x[386500:387000]
                self.entry774 = x[387000:387500]
                self.entry775 = x[387500:388000]
                self.entry776 = x[388000:388500]
                self.entry777 = x[388500:389000]
                self.entry778 = x[389000:389500]
                self.entry779 = x[389500:390000]
                self.entry780 = x[390000:390500]
                self.entry781 = x[390500:391000]
                self.entry782 = x[391000:391500]
                self.entry783 = x[391500:392000]
                self.entry784 = x[392000:392500]
                self.entry785 = x[392500:393000]
                self.entry786 = x[393000:393500]
                self.entry787 = x[393500:394000]
                self.entry788 = x[394000:394500]
                self.entry789 = x[394500:395000]
                self.entry790 = x[395000:395500]
                self.entry791 = x[395500:396000]
                self.entry792 = x[396000:396500]
                self.entry793 = x[396500:397000]
                self.entry794 = x[397000:397500]
                self.entry795 = x[397500:398000]
                self.entry796 = x[398000:398500]
                self.entry797 = x[398500:399000]
                self.entry798 = x[399000:399500]
                self.entry799 = x[399500:400000]
                self.entry800 = x[400000:400500]
                self.entry801 = x[400500:401000]
                self.entry802 = x[401000:401500]
                self.entry803 = x[401500:402000]
                self.entry804 = x[402000:402500]
                self.entry805 = x[402500:403000]
                self.entry806 = x[403000:403500]
                self.entry807 = x[403500:404000]
                self.entry808 = x[404000:404500]
                self.entry809 = x[404500:405000]
                self.entry810 = x[405000:405500]
                self.entry811 = x[405500:406000]
                self.entry812 = x[406000:406500]
                self.entry813 = x[406500:407000]
                self.entry814 = x[407000:407500]
                self.entry815 = x[407500:408000]
                self.entry816 = x[408000:408500]
                self.entry817 = x[408500:409000]
                self.entry818 = x[409000:409500]
                self.entry819 = x[409500:410000]
                self.entry820 = x[410000:410500]
                self.entry821 = x[410500:411000]
                self.entry822 = x[411000:411500]
                self.entry823 = x[411500:412000]
                self.entry824 = x[412000:412500]
                self.entry825 = x[412500:413000]
                self.entry826 = x[413000:413500]
                self.entry827 = x[413500:414000]
                self.entry828 = x[414000:414500]
                self.entry829 = x[414500:415000]
                self.entry830 = x[415000:415500]
                self.entry831 = x[415500:416000]
                self.entry832 = x[416000:416500]
                self.entry833 = x[416500:417000]
                self.entry834 = x[417000:417500]
                self.entry835 = x[417500:418000]
                self.entry836 = x[418000:418500]
                self.entry837 = x[418500:419000]
                self.entry838 = x[419000:419500]
                self.entry839 = x[419500:420000]
                self.entry840 = x[420000:420500]
                self.entry841 = x[420500:421000]
                self.entry842 = x[421000:421500]
                self.entry843 = x[421500:422000]
                self.entry844 = x[422000:422500]
                self.entry845 = x[422500:423000]
                self.entry846 = x[423000:423500]
                self.entry847 = x[423500:424000]
                self.entry848 = x[424000:424500]
                self.entry849 = x[424500:425000]
                self.entry850 = x[425000:425500]
                self.entry851 = x[425500:426000]
                self.entry852 = x[426000:426500]
                self.entry853 = x[426500:427000]
                self.entry854 = x[427000:427500]
                self.entry855 = x[427500:428000]
                self.entry856 = x[428000:428500]
                self.entry857 = x[428500:429000]
                self.entry858 = x[429000:429500]
                self.entry859 = x[429500:430000]
                self.entry860 = x[430000:430500]
                self.entry861 = x[430500:431000]
                self.entry862 = x[431000:431500]
                self.entry863 = x[431500:432000]
                self.entry864 = x[432000:432500]
                self.entry865 = x[432500:433000]
                self.entry866 = x[433000:433500]
                self.entry867 = x[433500:434000]
                self.entry868 = x[434000:434500]
                self.entry869 = x[434500:435000]
                self.entry870 = x[435000:435500]
                self.entry871 = x[435500:436000]
                self.entry872 = x[436000:436500]
                self.entry873 = x[436500:437000]
                self.entry874 = x[437000:437500]
                self.entry875 = x[437500:438000]
                self.entry876 = x[438000:438500]
                self.entry877 = x[438500:439000]
                self.entry878 = x[439000:439500]
                self.entry879 = x[439500:440000]
                self.entry880 = x[440000:440500]
                self.entry881 = x[440500:441000]
                self.entry882 = x[441000:441500]
                self.entry883 = x[441500:442000]
                self.entry884 = x[442000:442500]
                self.entry885 = x[442500:443000]
                self.entry886 = x[443000:443500]
                self.entry887 = x[443500:444000]
                self.entry888 = x[444000:444500]
                self.entry889 = x[444500:445000]
                self.entry890 = x[445000:445500]
                self.entry891 = x[445500:446000]
                self.entry892 = x[446000:446500]
                self.entry893 = x[446500:447000]
                self.entry894 = x[447000:447500]
                self.entry895 = x[447500:448000]
                self.entry896 = x[448000:448500]
                self.entry897 = x[448500:449000]
                self.entry898 = x[449000:449500]
                self.entry899 = x[449500:450000]
                self.entry900 = x[450000:450500]
                self.entry901 = x[450500:451000]
                self.entry902 = x[451000:451500]
                self.entry903 = x[451500:452000]
                self.entry904 = x[452000:452500]
                self.entry905 = x[452500:453000]
                self.entry906 = x[453000:453500]
                self.entry907 = x[453500:454000]
                self.entry908 = x[454000:454500]
                self.entry909 = x[454500:455000]
                self.entry910 = x[455000:455500]
                self.entry911 = x[455500:456000]
                self.entry912 = x[456000:456500]
                self.entry913 = x[456500:457000]
                self.entry914 = x[457000:457500]
                self.entry915 = x[457500:458000]
                self.entry916 = x[458000:458500]
                self.entry917 = x[458500:459000]
                self.entry918 = x[459000:459500]
                self.entry919 = x[459500:460000]
                self.entry920 = x[460000:460500]
                self.entry921 = x[460500:461000]
                self.entry922 = x[461000:461500]
                self.entry923 = x[461500:462000]
                self.entry924 = x[462000:462500]
                self.entry925 = x[462500:463000]
                self.entry926 = x[463000:463500]
                self.entry927 = x[463500:464000]
                self.entry928 = x[464000:464500]
                self.entry929 = x[464500:465000]
                self.entry930 = x[465000:465500]
                self.entry931 = x[465500:466000]
                self.entry932 = x[466000:466500]
                self.entry933 = x[466500:467000]
                self.entry934 = x[467000:467500]
                self.entry935 = x[467500:468000]
                self.entry936 = x[468000:468500]
                self.entry937 = x[468500:469000]
                self.entry938 = x[469000:469500]
                self.entry939 = x[469500:470000]
                self.entry940 = x[470000:470500]
                self.entry941 = x[470500:471000]
                self.entry942 = x[471000:471500]
                self.entry943 = x[471500:472000]
                self.entry944 = x[472000:472500]
                self.entry945 = x[472500:473000]
                self.entry946 = x[473000:473500]
                self.entry947 = x[473500:474000]
                self.entry948 = x[474000:474500]
                self.entry949 = x[474500:475000]
                self.entry950 = x[475000:475500]
                self.entry951 = x[475500:476000]
                self.entry952 = x[476000:476500]
                self.entry953 = x[476500:477000]
                self.entry954 = x[477000:477500]
                self.entry955 = x[477500:478000]
                self.entry956 = x[478000:478500]
                self.entry957 = x[478500:479000]
                self.entry958 = x[479000:479500]
                self.entry959 = x[479500:480000]
                self.entry960 = x[480000:480500]
                self.entry961 = x[480500:481000]
                self.entry962 = x[481000:481500]
                self.entry963 = x[481500:482000]
                self.entry964 = x[482000:482500]
                self.entry965 = x[482500:483000]
                self.entry966 = x[483000:483500]
                self.entry967 = x[483500:484000]
                self.entry968 = x[484000:484500]
                self.entry969 = x[484500:485000]
                self.entry970 = x[485000:485500]
                self.entry971 = x[485500:486000]
                self.entry972 = x[486000:486500]
                self.entry973 = x[486500:487000]
                self.entry974 = x[487000:487500]
                self.entry975 = x[487500:488000]
                self.entry976 = x[488000:488500]
                self.entry977 = x[488500:489000]
                self.entry978 = x[489000:489500]
                self.entry979 = x[489500:490000]
                self.entry980 = x[490000:490500]
                self.entry981 = x[490500:491000]
                self.entry982 = x[491000:491500]
                self.entry983 = x[491500:492000]
                self.entry984 = x[492000:492500]
                self.entry985 = x[492500:493000]
                self.entry986 = x[493000:493500]
                self.entry987 = x[493500:494000]
                self.entry988 = x[494000:494500]
                self.entry989 = x[494500:495000]
                self.entry990 = x[495000:495500]
                self.entry991 = x[495500:496000]
                self.entry992 = x[496000:496500]
                self.entry993 = x[496500:497000]
                self.entry994 = x[497000:497500]
                self.entry995 = x[497500:498000]
                self.entry996 = x[498000:498500]
                self.entry997 = x[498500:499000]
                self.entry998 = x[499000:499500]
                self.entry999 = x[499500:500000]

これも最初のと同じ方法でいいかな? (もう面倒臭くなってきた)

                for i in range(1000):
                    self.entry[i] = x[500 * i:500 * (i + 1)]

序でに書いておくと、Space と Tab が混在した Source で扱い辛いです。 Style Guide for Python Code (和譯) を知らないっぽい。一寸引用…

Python をコマンドラインから実行するときに、 -t オプションをつけると、ソースコード内にタブとスペースが不正に混在している旨を警告してくれる。 -tt オプションをつけると、警告ではなくエラーになる。これらのオプションをつけることを強く推奨する!

メッセージ總背番號制

#=======================================================================
# メッセージ定義帯
#=======================================================================
$MSG_0000 = '<!-- 上段広告スペース -->';
$MSG_0010 = '「';
$MSG_0020 = '」への返信入力';
$MSG_0030 =
<<________________________HTML_DATA________________________;
    <p>皆さん書き込んで下さいね!</p>
________________________HTML_DATA________________________
$MSG_0110 = '案内';
@MSG_0120 = (
    '<a href="#PostArea">記事を投稿する</a>',
    '<a href="#ControlPageArea">ページを操作する</a>',
    '<a href="#DeleteArea">記事を削除する</a>',
);
@MSG_0130 = (
    "<a href=\"$HOME_PAGE\">ホームページへ</a>",
);
$MSG_0140 = '<a href="%RETURN">一覧を表示</a>';
#   :
#   :   長いので省略
#   :
$MSG_8999 = '<!-- 下段広告スペース -->';
#=======================================================================
# メッセージ定義帯(システム系)
#=======================================================================
$MSG_9010 = '該当する記事が無い、又は削除されました';
#   :
#   :   長い長いので省略
#   :
$MSG_9090 = 'パスワードが入力されていません';
$MSG_9100 = 'ログファイルが見つかりません';
#   :
#   :   長い長い長いので省略
#   :
$MSG_9190 = '件名が長すぎます';
$MSG_9200 = '本文が長すぎます';
$MSG_9210 = '投稿フォーム';
$MSG_9990 = 'ver.2.05b';

此の遣り方だと Error が一切無くても Error Message の数だけ Scalar/Array に代入しないといけない。

ところで %RETURN って何じゃらほぃ?

また Programming Perl から Chapter 5 の冒頭を少し引用します。

わたしたちは、本来ならよい高いレベルの抽象化(単にループやサブルーチンで良い)を導入すべき局面で、カットアンドペーストで済ませてしまうという罠にしばしば陥りがちである (*1)。また、これとは正反対の極端に走り、本来ならカットアンドペーストで済ませるべきところを、高レベルの抽象化の山をどんどん築き上げてしまう人たちもいる (*2)。しかし、一般的に言えば、わたしたちのほとんどは、より多くの抽象化を行なうことを考えるべきである。

抑々(そもそも)、Error Message を Code に埋め込まないで別に纏める利点というのは「其処を書き換えても Compile 仕直さなくて済む」とか、そういう場合なんでないの?

$MSG = {
    0000 => '<!-- 上段広告スペース -->',
    0010 => '「',
    0020 => '」への返信入力',
    0030 => '<p>皆さん書き込んで下さいね!</p>',
    0110 => '案内',
    0120 => [
                '<a href="#PostArea">記事を投稿する</a>',
                '<a href="#ControlPageArea">ページを操作する</a>',
                '<a href="#DeleteArea">記事を削除する</a>',
            ],
    0130 => [
                qq'<a href="$HOME_PAGE">ホームページへ</a>"',
            ],
    0140 => '<a href="%RETURN">一覧を表示</a>',
#   :
#   :   長い長い長い長いので省略
#   :
    9990 => 'ver.2.05b',
};

Reference に変えてみても無駄は無駄ですが、これで $MSG->{8999} とか $MSG->{0120}->[2] とか書けて一寸丈け安上がり?

しかし、どうして番号で管理する必要があるのかが最大の疑問。エラー処理追加する度に番号調べないといけないし。判り易い名前を付けると困る事ってあるんだろうか?

(いたずら)悪戯(いたずら)を回避したい

一時、一部の[UG]方面で流行ってたらしい Carl 板です。

当時は「なんやわからん」と放っておいたんですが、今読んでみると冗長部分が多過ぎでした。

if ($value =~ /\r\n/) { $value =~ s/\r\n/\r/g; }
if ($value =~ /\n/)   { $value =~ s/\n/\r/g;   }
# 改行連打のいたずらを回避(3行以上何も書かずに改行のみの部分は改行無視)(by カール)
# スペース+改行の連打を回避(上記を回避するためにスペースをいれて改行する悪戯の場合)
if ($value =~ / \r \r/)     { $value =~ s/ \r \r//g;     }
if ($value =~ /\ \r\ \r/) { $value =~ s/\ \r\ \r//g; }
if ($value =~ / \r/)        { $value =~ s/ \r/\r/g;      }
if ($value =~ /\ \r/)      { $value =~ s/\ \r/\r/g;    }
if ($value =~ /\r\r\r\r/)   { $value =~ s/\r\r\r\r//g;   }
$value =~ s/\x0D+\x0A+/\r/g;
$value =~ tr/\n/\r/;
$value =~ s/(?:\s|\x81\x40)+(?=\r)//g;
if ($kyoka eq "") {
  &hostcheck;
} elsif ($host !~ /$kyoka/) {
  &hostcheck;
}
&hostcheck unless $kyoka or $host =~ /$kyoka/;
  $via    = $ENV{'HTTP_VIA'};
  $xfor   = $ENV{'HTTP_X_FORWARDED_FOR'};
  $for    = $ENV{'HTTP_FORWARDED'};
  $agent  = $ENV{'HTTP_USER_AGENT'};
($via, $xfor, $for, $agent) = @ENV{qw/
    HTTP_VIA
    HTTP_X_FORWARDED_FOR
    HTTP_FORWARDED
    HTTP_USER_AGENT
/};
  if ( ($FORM{'value'} eq '') || ($FORM{'value'} eq ' ') || ($FORM{'value'} eq ' ') ) {
    &html; # 内容が無い場合はリロード
  }
$FORM{value} =~ s/(?:\s|\x81\x40)+$//g;
&html unless $FORM{value};
#--- メイン処理 --------------------------------#
if ($action eq 'pas' && $FORM{'papost'} eq 'pcode') {
  &password;
}elsif($action eq 'ad' && $FORM{'admin'} eq 'change' && crypt($FORM{'pwd'}, substr($password,$salt,2)) eq $password) {
  &password;
}elsif($action eq 'ad' && $FORM{'admin'} eq 'kick' && crypt($FORM{'pwd'}, substr($password,$salt,2)) eq $password) {
  &kickhost;
}elsif($action eq 'ad' && $FORM{'admin'} eq 'cut' && crypt($FORM{'pwd'}, substr($password,$salt,2)) eq $password) {
  &remove1;
  exit;
}elsif($action eq 'sr') {
  &sremove;
}elsif($action eq 'osr' && crypt($FORM{'pwd'}, substr($password,$salt,2)) eq $password) {
  &sremove;
  &remove1;
  exit;
}elsif($action eq 'kickout' && crypt($FORM{'pwd'}, substr($password,$salt,2)) eq $password) {
  &kickhost;
  exit;
}elsif($action eq 'post') {  
  &regist;
}
&html;
exit;
#--- ここから下はサブルーチン --------------------------------#

同じ Check を何回もするのは無駄でしかない。

if ($action eq 'pas' && $FORM{papost} eq 'pcode')
{
    &password;
}
elsif ($action eq 'post')
{
    &regist;
}
elsif ($action eq 'sr')
{
    &sremove;
}
elsif ($password eq crypt $FORM{pwd}, substr $password, $salt, 2)
{
    if ($action eq 'ad')
    {
        if ($FORM{admin} eq 'change')
        {
            &password;
        }
        elsif ($FORM{admin} eq 'kick')
        {
            &kickhost;
        }
        elsif ($FORM{admin} eq 'cut')
        {
            &remove1;
            exit;
        }
    }
    elsif ($action eq 'kickout')
    {
        &kickhost;
        exit;
    }
    elsif ($action eq 'osr')
    {
        &sremove;
        &remove1;
        exit;
    }
}
&html;
exit;

怪奇現象

# マックバイナリ対策
if ($mac) {
    $len = substr($img_data,83,4);  $len = unpack("%N",$length);
    $img_data = substr($fileupload,128,$len);
}

奇怪な現象が起こってゐる。

  1. $len が上書きされてゐる。
  2. $length は何処から湧いて出たのか?
  3. $fileupload も何処から湧いて出たのか?

結果は常に同じ。

  1. 最初の $len は Data Fork の length を正しく得ようとしてゐるが、結局葬られる。
  2. 2つ目の $len は必ず 0 になる。
  3. 因って $img_data は必ず 空文字列。

其の儘修正すると此様な物にしかならないが、此れで良いのだらうか。

$img_data = substr $img_data, 128, unpack '%N', substr $img_data, 83, 4 if $mac;

文字化け Server に Error Script

digital-waseda.org は HTTP Header で charset=ISO-2022-JP を指定しつつ Shift JIS の File を送ってきますが、どういう積もりなんでしょうか。んで、この化け化け Server にある CGI Script 配布 Site なのですが、見本スクリプトが全て Internal Server Error です。

if($file eq ""){&index;}else{&html_top;}
#   : 一寸省略
sub index {

一回しか出てこないのに sub にした事にイチャモン付ける事は普通まず在りません。が、なんで名前を index にするんでしょう。後で index 使うかも知れん、とか考えないでしょうか……。 まぁ、必要なら &main::index とか CORE::index で呼び出せば使い分けられますが。 一応無難な方法を考えるなら、一文字大文字にしてみるとか、underscore 付けるとか。

! $file ? &_index : &html_top;
#   : 若干省略
sub _index {

んで、その sub 内にも絡むんですが、 <!-title-> なんて使って Markup 間違ってるゎ、と思ったら勘違いで、後で態々 $title に置き換える様です。

$title = "I_DIC";       # HTML のタイトル(デフォルト)
#   : 数行省略
$top2='<H1 ALIGN=CENTER><FONT COLOR="goldenrod">★</FONT><FONT COLOR="blue"><B><!-title-></B></FONT><FONT COLOR="goldenrod">★</FONT></H1><P><HR SIZE=1><P>';
#   : 数十行省略
    ($file, $title, $body, $top2, $headf, $wordf) = split(/<>/, $init);
sub index
{
    $top2 =~ s/<!-title->/$title/;
#   : 数十行省略
    $title = "$title Editor";
sub html_top
{
    $top2 =~ s/<!-title->/$title/;
sub head
{
    $top2 =~ s/<!-title->/$title/;
#   : 数百行省略
    elsif ($FORM{'title'} ne "")
    {
        $title = $FORM{'title'};
sub regist
{
    if ($FORM{'title'} ne "")
    {
        $title = $FORM{'title'};

何でこんなに面倒臭い方法なのか解りませんが何度も何度も上書きするんですね。

    }elsif($FORM{'title'} ne ""){
        $title=$FORM{'title'};$body=$FORM{'body'};$top2=$FORM{'top2'};
        $headf=$FORM{'headf'};$wordf=$FORM{'wordf'};

ホントに皆さんこういうの大好きですよね。なんでなんかな……。

    elsif ($FORM{title})
    {
        for (qw/title body top2 headf wordf/)
        {
            $$_ = $FORM{$_};
        }

なにがなんでも AppleScript で quotemeta 擬きを作りたい

さて、肝心の Script ですけど、ちょっと内容が HTML 向きでない (所謂 機種依存文字) ので escape.txt (579 lines, 1872 words, 14780 bytes) を見て貰うとして、一應説明を引用しておきます。

テキストファイルから Perl スクリプトで利用できる print 文に変換する AppleScript です。特殊記号や文字化けの可能性がある 2 バイト文字を自動的にエスケープし、各行を print 文として出力します。また、各種設定を柔軟にカスタマイズすることができるため、様々な利用法も可能です。
ドラッグ & ドロップされた複数のテキストファイルを一括変換します。

何故 AppleScript なのかが一寸解りませんが perl でやったほうが良いですねぇ。というか、 Perl Script で print 出来ない Text ってあるんでしょうか? ま、いいけど。云々……例えば、

#! perl -ni.bak
print quotemeta

こんなんで良いのでしょうか? 577 lines, 1868 words, 14748 bytes 節約できましたが。でも、此れって何か処理全体が完全に無駄ですよね。それとも……

#! perl -lpi.bak
BEGIN { print "print <<'EOF';" }
END { print "EOF" }

なのでしょうか? どっちにしろ、何を意図してるのかが謎なので、 何のこっちゃですゎ。

でも、この AppleScript の一番の問題は Description に Copyright しか書いて無いんで、 control 押し乍ら起動しても内容が分からない亊なんですけどねぇ。

References