perlquestion
tomazos
Suppose there is a function that generates one file based on another:
<p>
<code>
sub compile($$)
{
my ($source_filename, $output_filename) = @_;
... # compile source into output
}
</code>
<p>
and now we only want to execute the function if <code>$source_filename</code> has been modified more recently than <code>$output_filename</code>...
<p>
<code>
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);
}
</code>
<p>
I would like recommendations on the most robust and portable way to implement <code>compare_modification_times</code>. Any ideas?
<p>
Thanks for your time.
<p>
<!-- Node text goes above. Div tags should contain sig only -->
<div class="pmsig"><div class="pmsig-78023">
<hr>Andrew Tomazos | <a href="mailto:andrew@tomazos.com">andrew@tomazos.com</a> | <a href="http://www.tomazos.com">www.tomazos.com</a>
</div></div>