Perl Verify PMCoreBasedAD

来源:互联网 发布:安装mysql步骤 编辑:程序博客网 时间:2024/04/30 14:56
#!/usr/bin/perl -w


use strict;
use English;


use Carp;                
use Getopt::Long;       


use ReadConfFile;
use PerformDBOperations;


my ($confFile, $boolHelp) = ();


my $boolError = GetOptions("c=s" => \$confFile,
                           "h|help!" => \$boolHelp);


if ($boolHelp || $confFile eq "")
{
  Help();
  exit(0);
}


eval 
{
  # my $readConf = new ReadConfFile();
  my $readConf = ReadConfFile->new();
  my %confValues = $readConf->ReadConfFile($confFile);
  undef $readConf;


  while(my ($key, $value) = each %confValues)
  {
    print "$key => $value\n";
  }
};


if ($EVAL_ERROR)
{
  print "Fail to read $confFile!\n";
}


eval
{
  my $dbUser = "pmr";
  chomp(my $pmrPwd = `polpasmx -$dbUser`);


  my $pmrDbPtr = new PerformDBOperations();


  $pmrDbPtr->ConnectTo($dbUser, $pmrPwd);


  my $sql = "select co_gid, co_int_id, co_name, co_dn from utp_common_objects where co_dn like '%BRS%'";
  my $sth = $pmrDbPtr->DoSQLStatement($sql);


  print "\n-------------------------------------------------------------------------";
  print "\n|CO_GID\t\t\t|CO_INT_ID\t|CO_NAME\t|CO_DN\t\t|";
  print "\n-------------------------------------------------------------------------\n";


  while(my @arrRow = $sth->fetchrow())
  {
    foreach(0..$#arrRow)
    {
       print "|".$arrRow[$_]."\t";
    }
    print "|\n-------------------------------------------------------------------------\n";
  }
};


sub Help        
{       
  print " Usage: perl VerifyPMCoreBasedAD.pl -c <ConfigFileName with full path> -m <test mode> -label <label to be used in result file names>\n";


  print "\n Example: perl VerifyPMCoreBasedAD.pl -c /home/omc/test.cf -m 1 -label testrun \n";
}
原创粉丝点击