CAD-Firemen

 view release on metacpan or  search on metacpan

bin/fm_diff_config  view on Meta::CPAN


sub md5Sum {
  my $file = shift;

  my $fh;
  if(!open($fh, "<", $file)){
    return "";
  }
  binmode($fh);
  my $md5 = Digest::MD5->new();
  $md5->addfile($fh);
  return $md5->hexdigest();
}

our @binarySuffixes = ();
sub isBinary {
  my $file = shift;

  if(!-e $file){
    return 0;
  }

  if(-B $file){
    return 1;
  }

  if($file =~ m/[^\.]+\.([^\.]+)\.?[0-9]{0,}$/){
    foreach my $binEnd (@binarySuffixes){
      if(uc($1) eq uc($binEnd)){
        return 1;
      }
    }
  }
  return 0;
}

my $showVersion = 0;
my $verbose = 1;
my $quiet = 0;
my $printAdded = 0;
my $printChanged = 0;
my $printRemoved = 0;
my $ignorePaths = 0;
my $caseInsensitive = 0;
my $description = 0;
my $changeLog = 0;
my $binary = 0;
my $dbh;
my %cfg1Options = ();
my %cfg2Options = ();
my %cfg1Errors = ();
my %cfg2Errors = ();
my %added = ();
my %removed = ();
my %changed = ();
my %duplicates = ();
my %ignoredChanges = ();
my %descriptions = ();
my $username = "na";
eval{
  $username = getpwuid( $< );
};
if( $@ ){
  # $@ is $EVAL_ERROR
  # unix way has failed, so try the win32 way
  $username = Win32::LoginName;
}

Getopt::Long::Configure ("bundling", "auto_help");
if(!GetOptions (
  'version' => \$showVersion,
  'verbose|v:i' => \$verbose,
  'quiet|q' => \$quiet,
  'changed|c' => \$printChanged,
  'added|a' => \$printAdded,
  'removed|r' => \$printRemoved,
  'ignore-paths|p' => \$ignorePaths,
  'case-insensitive|i' => \$caseInsensitive,
  'description|d' => \$description,
  'changelog|l' => \$changeLog,
  'binary|b' => \$binary
)){
  pod2usage(2);
}

# for all of this files -B does not return
# true, despite the fact, that they contain binary content
@binarySuffixes = qw(
  win
  asm
  prt
  frm
  tbl
);

if($showVersion){
  CAD::Firemen::printVersion();
}

if($changeLog){
  $verbose = 0;
  $printAdded = 1;
  $printRemoved = 1;
  $printChanged = 1;
  $ignorePaths = 0;
  $caseInsensitive = 0;
  $description = 0;
}

if($quiet){
  $verbose = 0;
}

my $cfg1Url = shift;
my $cfg2Url = shift;

my $installPath = "";
if($description){
  $installPath = getInstallationPath();
}



( run in 0.893 second using v1.01-cache-2.11-cpan-39bf76dae61 )