文章详情

  • 游戏榜单
  • 软件榜单
关闭导航
热搜榜
热门下载
热门标签
php爱好者> php文档>检索CPP文件与table的关系

检索CPP文件与table的关系

时间:2007-02-08  来源:roywangt

    在大量的编码后,很难了解一个程序会与那些数据库表有关联。这些在后期开发、维护都存在着一定的风险。目前想通过perl脚本对相关的程序源码进行检索,并且罗列出每个文件与表之间的对应关系。 初步完成一个简单的检索脚本,后期不断的进行新功能的添加。

use File::Find;
%tableset ;
sub init;
sub deal_file ;
sub ana_file;
my $main="/bill/TIBS_HOME/";
print "进行文件分析\n";
find (\&deal_file ,$main);
##########################sub######################
sub init{
%tableset=(
"ZONE_ITEM_VALUE"=>0);
}
sub deal_file{
 ana_file($File::Find::name) if m/\.cpp$|\.h$/ ;
}
sub ana_file{
 my @tempSet;
 init();
 open FILE , $_[0]  or die " $_[0] is error \n";
 while (<FILE>) {
  foreach $table_name(keys%tableset) {
   if ($tableset{$table_name} == 0) {
    if (m/ $table_name /i) {
     push  @tempSet , $table_name;
     $tableset{$table_name} = 1;
    }    
   }
  }
 }
 close FILE;
 my $counts=@tempSet;
 if ($counts>0) {
  open WriteFile , ">>$table_name " or die " $_[0] is error \n";
  print WriteFile  $File::Find::name."\n";
  print WriteFile  "================================================================\n";
  foreach  $tempTablename(@tempSet) {
   print WriteFile  "=======> $tempTablename ;\n";
  }
  print WriteFile  "=================================================================\n";
  close WriteFile;
 }
}
相关阅读 更多 +
排行榜 更多 +
方块枪战战场安卓版

方块枪战战场安卓版

飞行射击 下载
战斗火力射击安卓版

战斗火力射击安卓版

飞行射击 下载
空中防御战安卓版

空中防御战安卓版

飞行射击 下载