summaryrefslogtreecommitdiff
path: root/Porting
diff options
context:
space:
mode:
Diffstat (limited to 'Porting')
-rw-r--r--Porting/checkpodencoding.pl69
-rw-r--r--Porting/release_managers_guide.pod2
-rw-r--r--Porting/release_schedule.pod2
3 files changed, 73 insertions, 0 deletions
diff --git a/Porting/checkpodencoding.pl b/Porting/checkpodencoding.pl
new file mode 100644
index 0000000000..a2d12df494
--- /dev/null
+++ b/Porting/checkpodencoding.pl
@@ -0,0 +1,69 @@
+#!/usr/bin/env perl
+use 5.010;
+use open qw< :encoding(utf8) :std >;
+use autodie;
+use strict;
+use File::Find;
+use Encode::Guess;
+
+# Check if POD files contain non-ASCII without specifying
+# =encoding. Run it as:
+
+## perl Porting/checkpodencoding.pl
+
+find(
+ {
+ wanted => \&finder,
+ no_chdir => 1,
+ },
+ '.'
+);
+
+sub finder {
+ my $file = $_;
+
+ return if -B $file;
+
+ open my $fh, '<', $file;
+
+ #say STDERR "Checking $file";
+
+ next if
+ # Test cases
+ $file ~~ m[Pod-Simple/t];
+
+ my ($in_pod, $has_encoding, @non_ascii);
+
+ FILE: while (my $line = <$fh>) {
+ chomp $line;
+ if ($line ~~ /^=[a-z]+/) {
+ $in_pod = 1;
+ }
+
+ if ($in_pod) {
+ if ($line ~~ /^=encoding (\S+)/) {
+ $has_encoding = 1;
+ last FILE;
+ } elsif ($line ~~ /[^[:ascii:]]/) {
+ my $encoding = guess_encoding($line);
+ push @non_ascii => {
+ num => $.,
+ line => $line,
+ encoding => (ref $encoding ? "$encoding->{Name}?" : 'unknown!'),
+ };
+ }
+ }
+
+ if ($line ~~ /^=cut/) {
+ $in_pod = 0;
+ }
+ }
+
+ if (@non_ascii and not $has_encoding) {
+ say "$file:";
+ $DB::single = 1;
+ for (@non_ascii) {
+ say " $_->{num} ($_->{encoding}): $_->{line}";
+ }
+ }
+}
diff --git a/Porting/release_managers_guide.pod b/Porting/release_managers_guide.pod
index a07268a3e2..d552650152 100644
--- a/Porting/release_managers_guide.pod
+++ b/Porting/release_managers_guide.pod
@@ -1,3 +1,5 @@
+=encoding utf8
+
=head1 NAME
release_managers_guide - Releasing a new version of perl 5.x
diff --git a/Porting/release_schedule.pod b/Porting/release_schedule.pod
index 45a6fcc58f..c0b74f4e27 100644
--- a/Porting/release_schedule.pod
+++ b/Porting/release_schedule.pod
@@ -1,3 +1,5 @@
+=encoding utf8
+
=head1 Release schedule
This document lists the release engineers for at least the next