3 use open qw< :encoding(utf8) :std >;
9 # Check if POD files contain non-ASCII without specifying
10 # =encoding. Run it as:
12 ## perl Porting/checkpodencoding.pl
27 open my $fh, '<', $file;
29 #say STDERR "Checking $file";
33 $file ~~ m[Pod-Simple/t];
35 my ($in_pod, $has_encoding, @non_ascii);
37 FILE: while (my $line = <$fh>) {
39 if ($line ~~ /^=[a-z]+/) {
44 if ($line ~~ /^=encoding (\S+)/) {
47 } elsif ($line ~~ /[^[:ascii:]]/) {
48 my $encoding = guess_encoding($line);
52 encoding => (ref $encoding ? "$encoding->{Name}?" : 'unknown!'),
57 if ($line ~~ /^=cut/) {
62 if (@non_ascii and not $has_encoding) {
66 say " $_->{num} ($_->{encoding}): $_->{line}";