Skip to content

Commit ee639d2

Browse files
committed
Fix copyright.pl to properly us 'tie' function.
Kris Jurka
1 parent 6dfcada commit ee639d2

File tree

2 files changed

+6
-7
lines changed

2 files changed

+6
-7
lines changed

src/tools/backend/flow.gif

1 Byte
Loading

src/tools/copyright.pl

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
use warnings;
1212

1313
use File::Find;
14+
use Tie::File;
1415

1516
my $pgdg = 'PostgreSQL Global Development Group';
1617
my $cc = 'Copyright \(c\) ';
@@ -22,14 +23,12 @@
2223
find({wanted => \&wanted, no_chdir => 1}, '.');
2324

2425
sub wanted {
25-
my $filename = $File::Find::name;
26+
return if ! -f $File::Find::name || -l $File::Find::name;
2627

27-
# only regular files
28-
return if ! -f $filename;
28+
my @lines;
29+
tie @lines, "Tie::File", $File::Find::name;
2930

30-
open(my $FILE, '<', $filename) or die "Cannot open $filename";
31-
32-
foreach my $line (<$FILE>) {
31+
foreach my $line (@lines) {
3332
# We only care about lines with a copyright notice.
3433
next unless $line =~ m/$cc.*$pgdg/;
3534
# We stop when we've done one substitution. This is both for
@@ -39,7 +38,7 @@ sub wanted {
3938
last if $line =~ s/($cc\d{4})(, $pgdg)/$1-$year$2/;
4039
last if $line =~ s/($cc\d{4})-\d{4}(, $pgdg)/$1-$year$2/;
4140
}
42-
close($FILE) or die "Cannot close $filename";
41+
untie @lines;
4342
}
4443

4544
print "Manually update doc/src/sgml/legal.sgml and src/interfaces/libpq/libpq.rc.in too\n";

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy