Name: Anonymous 2009-02-08 16:52
I'm editing some perl and my output isn't what it should be.
its outputing like file names as the same file name.
ie pch1-3_0.spch & pch1-3_1.spch are both outputed as pch1-3_1.spch so it generates pch1-3_1.spch twice.
what it pertains to in the rest of the script.
any ideas or clues?
its outputing like file names as the same file name.
ie pch1-3_0.spch & pch1-3_1.spch are both outputed as pch1-3_1.spch so it generates pch1-3_1.spch twice.
opendir (THISDIR, "$pch_file_directory") || die "No Directory";
while ( $file_name = readdir(THISDIR)){
if($file_name =~ /.*\.pch/ || $file_name =~ /.*\.spch/){
$i++;
#ファイル編集時間取得
($hour, $min, $sec, $mday, $mon, $year)=localtime((stat("$pch_file_directory$file_name"))[9]);
#ファイルデータサイズ取得
$byte = (stat("$pch_file_directory$file_name"))[7];
if($byte > 0 && $byte < 1024) { $byte = 1024;}
#表示時間修正処理
$year += 1900;
$mon = sprintf("%02d", ++$mon);
$mday = sprintf("%02d", $mday);
$hour = sprintf("%02d", $hour);
$min = sprintf("%02d", $min);
$sec = sprintf("%02d", $sec);
#日付リスト作成
$file_time[$i] = int("$year$mon$mday$hour$min$sec");
#ファイル情報テーブルに代入
$file_table{$file_time[$i]}[0] = "$file_name";
#$newvar{$file_time[$i]}[0] = "$file_name";
$file_table{$file_time[$i]}[1] = "$mon/$mday/$year";
$file_table{$file_time[$i]}[2] = int( $byte / 1024 + 0.5 );
}
}
closedir THISDIR;what it pertains to in the rest of the script.
for($i,$c=0;$c<=$i;$c++){
#print qq($file_table{$file_time[$c]}[0] <br />);
#表示ファイルサイズ確認
if($file_table{$file_time[$c]}[2] > $printbyte){
#ファイル数カウント
$files_count++;
$vres = ($page + 1) * $epp; # view results
if ($files_count > ($vres - $epp) && files_count <= $vres) {
if( $file_table{$file_time[$c]}[0] =~ /.*\.pch/ ) {
print qq( <td>\n).
qq( <a href="$ENV{'SCRIPT_NAME'}?mode=$file_table{$file_time[$c]}[0]&printapplet=$printappletv2">$file_table{$file_time[$c]}[0]</a>\n).
qq( </td>\n);
} elsif ( $file_table{$file_time[$c]}[0] =~ /.*\.spch/ ) {
print qq( <td>\n).
qq( <a href="$ENV{'SCRIPT_NAME'}?mode=$file_table{$file_time[$c]}[0]&printapplet=$printappletv3">$file_table{$file_time[$c]}[0]</a>\n).
qq( </td>\n);
}
print qq( <td>\n $file_table{$file_time[$c]}[2] KB\n </td>\n <td>\n $file_table{$file_time[$c]}[1]\n </td>\n);
if($print_download eq "1"){
print qq( <td class="center">\n <a href="$print_dir_url$file_table{$file_time[$c]}[0]">Download</a>\n </td>\n);
}
print qq( </tr>\n <tr>\n);
}
}
}any ideas or clues?