If you want to be a bit more thorough, you could do something like
use File::Spec::Functions( rel2abs canonpath );
my $full_inpath = canonpath( rel2abs( $infile ) );
my $full_outpath = canonpath( rel2abs( $outfile ) );
if ( $full_inpath eq $full_outpath ) { ... }
Yes, there are ways to fool this. Ideally, there would be some is_same_real_file() in
File::Spec that would take into account symlinks, case sensitivity, volume names, and the like.
My criteria for good software:
- Does it work?
- Can someone else come in, make a change, and be reasonably certain no bugs were introduced?