in reply to File synchronisation (for criticism)
You are doing a lot of checking of parameters. 2 ways I use to make this clearer (and 1 other comment) are :
Perl will check that you are getting 2 scalars and 2 hashrefs and generate an error for you if not met. If the caller provides a hash, not a ref, Perl also generates the ref for you - DWIM.sub CompareTrees($$\%\%)
I think that is clearer and quicker to read and doesn't reduce reduce the usability.sub CompareTrees { @_ == 4 || warn "CompareTrees($srcPath,$destPath,\%srcTree, \%destTree)" && return undef; my ($sourcePath,$destPath,$sourceTree, $destTree) = @_;
sub CompareTrees { @_ == 4 || die "CompareTrees($srcPath,$destPath,\%srcTree,\%destTree)"; my ($sourcePath,$destPath,$sourceTree, $destTree) = @_;
|
|---|