#!/usr/bin/perl
# Copyright (C) 2001-2003 All right reserved by Shinya Kondo ( CGI KON )
require "cgi-lib.pl";
# 検索ページの表示
print "Content-type: text/html\n\n";
print qq!
NOAH VM検索 NOAH VM検索
$error
!;
# 検索用関数
sub Search_Pattern
{
my($record,@pattern) = @_;
foreach (@pattern) {
return 0 if($record !~ /$_/);
}
return 1;
}
@filename = ("VCA1_vmlist_111110_0900.csv","VCB1_vmlist_111110_0900.csv","VCYE1_vmlist_111110_0900.csv","VCC1_vmlist_111110_0900.csv","VCD1_vmlist_111110_0900.csv","vcETV1_vmlist_111110_0900.csv","vcETY1_vmlist_111110_0900.csv","VCSTARTIA1_vmlist_111110_0900.csv","VCYA1_vmlist_111110_0900.csv","VCYB1_vmlist_111110_0900.csv","VCYC1_vmlist_111110_0900.csv","VCYD1_vmlist_111110_0900.csv","VCYF1_vmlist_111110_0900.csv");
# メインプログラム
foreach $tmp (@filename) {
&ReadParse;
$keyword = $in{"keyword"};
if($in{'search'}) {
if(!$keyword) {
$error = "キーワードが入力されていません";
$in{'search'} = "";
}
}
if($in{'search'}) {
if(!open(IFILE, $tmp)) {
$error = "該当ファイルを参照できません";
$in{'search'} = "";
}
}
if($in{'search'}) {
print qq!\n!;
$title = ;
chomp($title);
@column = split(",",$title);
print qq!\n!;
foreach (@column) {
print qq!$_ | \n!;
}
print qq!
\n!;
$keyword =~ s/ / /g;
@pattern = split(/ /,$keyword);
while($line = ) {
next if(!&Search_Pattern($line,@pattern));
chomp($line);
@column = split(",",$line);
print qq!\n!;
foreach (@column) {
print qq!$_ | \n!;
}
print qq!
\n!;
}
close(IFILE);
print qq!
\n!;
} else {
}
}
print qq!
!;