The Perl Toolchain Summit 2025 Needs You: You can help 🙏 Learn more

use 5.10.0;
use strict;
use Test::More tests => 1;
my $t = localtime;
my $this_year = $t->year;
my @files = (
'README',
'LICENSE',
'lib/Term/Choose.pm',
'lib/Term/Choose/LineFold.pm',
);
my $author = 'Matth..?us Kiem';
my $error = 0;
my $diag = '';
for my $file ( @files ) {
open my $fh, '<', $file or die $!;
while ( my $line = <$fh> ) {
if ( $line =~ /copyright(?: \(c\))? .*$author/i ) {
if ( $line !~ /copyright(?: \(c\))? 20\d\d-\Q$this_year\E /i && $line !~ /copyright(?: \(c\))? \Q$this_year\E /i ) {
$diag .= sprintf( "%15s - line %d: %s\n", $file, $., $line );
$error++;
}
}
}
close $fh;
}
ok( $error == 0, "Copyright year" ) or diag( $diag );
diag( "\n" );