Compare-Directory
view release on metacpan or search on metacpan
lib/Compare/Directory.pm view on Meta::CPAN
else {
$self->{report}->($f1, $f2) unless _cmp_directory($f1, $f2);
# Very strict about the order of elements in XML.
# $self->{report}->($f1, $f2) if File::Compare::compare($f1, $f2);
}
}
return $self->{_status};
}
sub _cmp_directory($$) {
my ($file1, $file2) = @_;
croak("ERROR: Invalid file [$file1].\n") unless(defined($file1) && (-f $file1));
croak("ERROR: Invalid file [$file2].\n") unless(defined($file2) && (-f $file2));
my $do_FILEs_match = 0;
if ($file1 =~ /\.txt|\.csv/i) {
$do_FILEs_match = 1 unless compare($file1, $file2);
}
elsif ($file1 =~ /\.xml/i) {
lib/Compare/Directory.pm view on Meta::CPAN
elsif ($file1 =~ /\.pdf/i) {
$do_FILEs_match = 1 if _cmp_pdf($file1, $file2);
}
elsif ($file1 =~ /\.xls/i) {
$do_FILEs_match = 1 if compare_excel($file1, $file2);
}
return $do_FILEs_match;
}
sub _cmp_pdf($$) {
my ($got, $exp) = @_;
unless (blessed($got) && $got->isa('CAM::PDF')) {
$got = CAM::PDF->new($got)
|| croak("ERROR: Couldn't create CAM::PDF instance with: [$got]\n");
}
unless (blessed($exp) && $exp->isa('CAM::PDF')) {
$exp = CAM::PDF->new($exp)
|| croak("ERROR: Couldn't create CAM::PDF instance with: [$exp]\n");
( run in 0.640 second using v1.01-cache-2.11-cpan-65fba6d93b7 )