Directory-Diff
view release on metacpan or search on metacpan
lib/Directory/Diff.pm view on Meta::CPAN
if (! -d $dir1) {
croak "directory_diff: first directory '$dir1' does not exist";
}
if (! -d $dir2) {
croak "directory_diff: second directory '$dir2' does not exist";
}
if ($verbose) {
print "Directory diff of $dir1 and $dir2 in progress ...\n";
}
if (! $callback_ref) {
croak "directory_diff: no callbacks supplied";
}
if (ref $callback_ref ne "HASH") {
croak "directory_diff: callback not hash reference";
}
my %ls_dir1 = ls_dir ($dir1, $verbose);
my %ls_dir2 = ls_dir ($dir2, $verbose);
# Data to pass to called back functions.
my $data = $callback_ref->{data};
# Call back a function on each file which is only in directory 1.
my $d1cb = $callback_ref->{dir1_only};
lib/Directory/Diff.pod view on Meta::CPAN
C<data>. The second argument to C<dir1_only> and C<dir2_only> is the
directory's name. The third argument is the file name, which includes
the subdirectory part. The second and third arguments to C<diff> are
the two directories, and the fourth argument is the file name
including the subdirectory part.
If the user does not supply a callback, no action is taken, even if a
file is found.
The routine does not return a meaningful value. It does not check the
return values of the callbacks. Therefore if it is necessary to stop
midway, the user must use something like C<eval { }> and C<die>.
A fourth argument, if set to any true value, causes directory_diff to
print messages about what it finds and what it does.
=head2 ls_dir
my %ls = ls_dir ("dir");
C<ls_dir> makes a hash containing a true value for each file and
( run in 0.291 second using v1.01-cache-2.11-cpan-9b1e4054eb1 )