require Exporter;
-$VERSION = '1.1004';
+$VERSION = '1.1005';
@ISA = qw(Exporter);
@EXPORT = qw(compare);
@EXPORT_OK = qw(cmp compare_text);
} elsif (ref(\$from) eq 'GLOB') {
*FROM = $from;
} else {
- open(FROM,"<$from") or goto fail_open1;
+ open(FROM,"<",$from) or goto fail_open1;
unless ($text_mode) {
binmode FROM;
$fromsize = -s FROM;
} elsif (ref(\$to) eq 'GLOB') {
*TO = $to;
} else {
- open(TO,"<$to") or goto fail_open2;
+ open(TO,"<",$to) or goto fail_open2;
binmode TO unless $text_mode;
$closeto = 1;
}
}
}
-print "1..12\n";
+print "1..13\n";
use File::Compare qw(compare compare_text);
my $template = File::Spec->catfile(File::Spec->tmpdir, 'fcmpXXXX');
my($tfh,$filename) = mkstemp($template);
+ open my $tfhCR, ">", "$filename\cM"
+ or die "Could no open '$filename^M' for writing: $!";
{
local $/; #slurp
my $fh;
my $data = <$fh>;
print $tfh $data;
close($fh);
+ print $tfhCR $data;
+ close($tfhCR);
}
seek($tfh,0,0);
$donetests[0] = compare($tfh, 'README');
$donetests[1] = compare($filename, 'README');
unlink0($tfh,$filename);
+ $donetests[2] = compare('README', "$filename\cM");
+ unlink "$filename\cM";
};
-print "# problems when testing with a tempory file\n" if $@;
+print "# problem '$@' when testing with a temporary file\n" if $@;
-if (@donetests == 2) {
+if (@donetests == 3) {
print "not " unless $donetests[0] == 0;
- print "ok 11\n";
+ print "ok 11 # fh/file [$donetests[0]]\n";
if ($^O eq 'VMS') {
# The open attempt on FROM in File::Compare::compare should fail
# on this OS since files are not shared by default.
print "not " unless $donetests[1] == -1;
- print "ok 12\n";
+ print "ok 12 # file/file [$donetests[1]]\n";
}
else {
print "not " unless $donetests[1] == 0;
- print "ok 12\n";
+ print "ok 12 # file/file [$donetests[1]]\n";
}
+ print "not " unless $donetests[2] == 0;
+ print "ok 13 # file/fileCR [$donetests[2]]\n";
}
else {
- print "ok 11# Skip\nok 12 # Skip Likely due to File::Temp\n";
+ print "ok 11# Skip\nok 12 # Skip\nok 13 # Skip Likely due to File::Temp\n";
}