tomazos has asked for the wisdom of the Perl Monks concerning the following question:
Suppose there is a function that generates one file based on another:
sub compile($$) { my ($source_filename, $output_filename) = @_; ... # compile source into output }
and now we only want to execute the function if $source_filename has been modified more recently than $output_filename...
sub compare_modification_times($$) { my ($file_a, $file_b) = @_; ??? } my $src = "wee.foo"; my $dest = "wee.bar"; if (compare_modification_times($src, $dest) < 0) { compile($src, $dest); }
I would like recommendations on the most robust and portable way to implement compare_modification_times. Any ideas?
Thanks for your time.
Back to
Seekers of Perl Wisdom