Please visit our sponsor
UNKNOWN
=**************************************
= Name: readAndCompare.pl
= Description:This script was created with
the intent of comparing two files, one in a production
environment with that under source code control.
= By: James Aguirre
=
=
= Inputs:Inputs:
Paths to files you'd like
to difference.
=
= Returns:Message if the compared files are different.
=
=Assumes:Using perl -w yields an irrelivant
message for line 21
The comparison wil be *-Binary-*
so whitespace
is NOT ignored.
=
=Side Effects:Files are opened
as ReadOnly.
=This code is copyrighted and has limited warranties.
=Please see http://www.Planet-Source-Code.com/xq/ASP/txtCodeId.127/lngWId.6/qx/vb/scripts/ShowCode.htm
=for details.
=**************************************
#################################################
# File: readAndCompare.pl
#
# Synopsis: This file was written as a replacement
# for the DOS file compare command, and is
# equivalent to fc /b (BINARY)
# so whitespace is NOT IGNORED. It was created with
# the intent of compareing files in a production
# environment with that under source code control
#
# Written by: James Aguirre -- 08-29-2000
#################################################
!#usr/bin/perl
# provide the paths to the file
# Grab the paths from cmd line.
print "Enter Path to Production file.\n";
chomp($pPath=);
##### DEBUG #####
#print "Path Given was $pPath\n";
print "Enter Path to Versioned file.\n";
chomp($vPath=);
# Check that the command line args were not equal.
if($pPath eq $vPath)
{
print "Cannot compare the same file\n";
exit;
}
##### DEBUG #####
#print "Path Given was $vPath\n";
# Open the production file.
open(PROD, "< $pPath") or die "Can't read the production file";
# write to a scalar
while()
{
$pHandle .=$_
}
# Close the filehandle
close(PROD) or die "Can't close the production file.";
# Open the versioned file Read Only.
open(VERS, "< $vPath") or die "Can't read the versioned file";
# write to a scalar
while()
{
$vHandle .=$_
}
# Close the filehandle
close(VERS) or die "Can't close the versioned file.";
# Compare the scalars
###### NOTE: this is a -- BINARY -- compare.
if($vHandle ne $pHandle)
{
print "Production file differs from versioned file.\n";
}
else
{
# Clever alert Message -?
exit;
}