~percona-toolkit-dev/percona-toolkit/pt-osc-asks-for-confirmation-when-alter-foreign-key-method-none-1329422

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#!/usr/bin/env perl

use strict;
use warnings FATAL => 'all';
use English qw(-no_match_vars);

eval {
   my ($year, $copyright)       = @ARGV;
   my ($years) = $copyright     =~ m/(\S+) Percona LLC and\/or its affiliates/;
   my ($first_year, $last_year) = split /-/, $years;

   my $new_copyright;
   if ( $first_year && $last_year ) {
      $new_copyright = "$first_year-$year Percona LLC and/or its affiliates"
   }
   elsif ( $first_year < $year ) {
      $new_copyright = "$first_year-$year Percona LLC and/or its affiliates"
   }
   else {
      $new_copyright = "$first_year Percona LLC and/or its affiliates"
   }

   $copyright =~ s/\S+ Percona LLC and\/or its affiliates/$new_copyright/;
   print $copyright;
};
die $EVAL_ERROR if $EVAL_ERROR;

exit 0;