Gen_20080726_01


※上記の広告は60日以上更新のないWIKIに表示されています。更新することで広告が下部へ移動します。

aaa

Gen_20080726_01

#!/usr/local/bin/perl
# 上の1行の前には空行も空白文字もはいらないようにしてください。
# perlのパス名はプロバイダや環境に合わせて変更してください。

#require "jcode.pl";

sub make_out_filename {
    print "DEBUG: [ 0 ]=$_[0]<br>\n";
    my $aa = $dot_HTML_base_file_name . $_[0] . $dot_HTML_file_ext;
    print "DEBUG: $aa=$aa<br>\n";
    return($aa);
}

sub resheadprint {

print "<HTML>\n";
print "<HEAD>\n";
print "<TITLE>CGI TEST</TITLE>\n";
print "</HEAD>\n";
print "<BODY BGCOLOR='#FFFFFF' TEXT='#000000'>\n";

print("===========================================<br>\n");
print("<br>\n");

}

sub restailprint {

#
# HTMLの終わりの部分を書き出します。
#
print("===========================================<br>\n");
print("<br>\n");

print "</XMP>\n";
print "</BODY>\n";
print "</HTML>\n";
print "\n";

}

sub headprint {

# print OUT "$_<BR>\n";
print OUT "<HTML>\n";
print OUT "<HEAD>\n";
print OUT "<TITLE>CGI TEST</TITLE>\n";
print OUT "</HEAD>\n";
print OUT "<BODY BGCOLOR='#FFFFFF' TEXT='#000000'>\n";

print OUT "===========================================<br>\n";
print OUT "<br>\n";

}

sub detailprint {

#print OUT "$_[0] . <BR>\n";
# print OUT "$_[0]<BR>\n";
print OUT "$_[0] <BR>\n";

}

sub tailprint {

#
# HTMLの終わりの部分を書き出します。
#
print OUT "===========================================<br>\n";
print OUT "<br>\n";

print OUT "</XMP>\n";
print OUT "</BODY>\n";
print OUT "</HTML>\n";
print OUT "\n";

}

sub listsyori {

$dot_control_file = "xxx.clf";
$dot_format_file = "xxx.f";
$dot_data_file = "xxx.dat";
$dot_HTML_base_file_name = "xxx";
$dot_HTML_file_ext = ".html";

$maxlpp = 5;
$i = 1;
$j = 1;

print "DEBUG: dot_HTML_base_file_name = $dot_HTML_base_file_name<br>\n";
print "DEBUG: dot_HTML_file_ext = $dot_HTML_file_ext<br>\n";
print "DEBUG: dot_data_file = $dot_data_file<br>\n";

open(IN, $dot_data_file);

#$outfile = make_out_filename ($j);
#print "DEBUG: outfile = $outfile<br>\n";

# open(OUT, "> $outfile");
# close(OUT);

$outfile = make_out_filename ($j);
print "DEBUG: outfile = $outfile<br>\n";

open(OUT, "> $outfile");

&headprint();

 while (<IN>) {

#$outfile = make_out_filename ($j);
#print "DEBUG: outfile = $outfile<br>\n";

# $j++;

chomp;
# chomp;

# print;
# print;
# print "$_<BR>\n";

#open(OUT, "> $outfile");

#&headprint();

# print OUT "$_<BR>\n";


 if ($i > $maxlpp) {

     # ブレーク時の処理
#     print "大きい\n";
     &tailprint();
     close(OUT);

     $j++;
     $i = 1;

     print "j : $j<BR>\n";
     print "i : $i<BR>\n";

     $outfile = make_out_filename ($j);
     print "DEBUG: outfile = $outfile<br>\n";

     open(OUT, "> $outfile");

     &headprint();

     print "$_<BR>\n";
     &detailprint($_);

     print "j : $j<BR>\n";
     print "i : $i<BR>\n";

 } else {

     # ノンブレーク時の処理
#     print "小さい\n";
     chomp;
     print "$_<BR>\n";
     &detailprint($_);

     $i++;

     print "j : $j<BR>\n";
     print "i : $i<BR>\n";

 }


}

&tailprint();

close(OUT);

close(IN);


}

# モジュール読み込み
use strict;
use CGI;

#my ($buffer);

# オブジェクト作成
my $query = new CGI;

# $f = $_POST['filename'];
#my $filename = $query->param('filename02');
#my $filemode = $query->param('filemode');

# HTML出力
print $query->header(-charset=>'Shift_JIS'),
      $query->start_html(-lang=>'ja', -encoding=>'Shift_JIS', -title=>'test01.cgi');


#
# CGIのヘッダを書き出します。通常は text/html を指定します。
#
#print "Content-type: text/html\n";
#print "\n";

#&resheadprint();

# &headprint();

&listsyori();

# &tailprint();
#&restailprint();

print $query->end_html;
exit;


aaa