9 Tests that the latest copyright years in the top-level README file and the
10 C<perl -v> output match each other.
12 If the test fails, update at least one of README and perl.c so that they match
15 Optionally you can pass the C<--now> option to check they are at the current
16 year. This isn't checked by default, so that it doesn't fail for people
17 working on older releases. It should be run before making a new release.
25 BEGIN { require 'test.pl' }
27 if ( $Config{usecrosscompile} ) {
28 skip_all( "Not all files are available during cross-compilation" );
33 my $readme_year = readme_year();
34 my $v_year = v_year();
36 # Check that both copyright dates are up-to-date, but only if requested, so
37 # that tests still pass for people intentionally working on older versions:
40 my $current_year = (gmtime)[5] + 1900;
41 is $v_year, $current_year, 'perl -v copyright includes current year';
42 is $readme_year, $current_year, 'README copyright includes current year';
45 # Otherwise simply check that the two copyright dates match each other:
48 is $readme_year, $v_year, 'README and perl -v copyright dates match';
55 # returns the latest copyright year from the top-level README file
58 open my $readme, '<', '../README' or die "Opening README failed: $!";
60 # The copyright message is the first paragraph:
62 my $copyright_msg = <$readme>;
64 my ($year) = $copyright_msg =~ /.*\b(\d{4,})/s
65 or die "Year not found in README copyright message '$copyright_msg'";
72 # returns the latest copyright year shown in perl -v
75 my $output = runperl switches => ['-v'];
76 my ($year) = $output =~ /copyright 1987.*\b(\d{4,})/i
77 or die "Copyright statement not found in perl -v output '$output'";