my @lines;
tie @lines, "Tie::File", $File::Find::name;
+ # We process all lines because some files have copyright
+ # strings embedded in them, e.g. src/bin/psql/help.c
foreach my $line (@lines)
{
# We only care about lines with a copyright notice.
next unless $line =~ m/$cc.*$pgdg/i;
- # Skip line if already matches the current year; if not
- # we get $year-$year, e.g. 2012-2012
+ # Skip line if it already matches the current year; if not
+ # we get $year-$year, e.g. 2012-2012.
next if $line =~ m/$cc $year, $pgdg/i;
- # We process all lines because some files have copyright
- # strings embedded in them, e.g. src/bin/psql/help.c
+ # Skip already-updated lines too, to avoid unnecessary
+ # file updates.
+ next if $line =~ m/$cc \d{4}-$year, $pgdg/i;
+
+ # Apply the update, relying on Tie::File to write the file.
$line =~ s/$cc (\d{4})-\d{4}, $pgdg/$ccliteral $1-$year, $pgdg/i;
$line =~ s/$cc (\d{4}), $pgdg/$ccliteral $1-$year, $pgdg/i;
}