Subject: | [PATCH] also accept IANA preferred name: UTF-8 |
Documentation::RequirePODUseEncodingUTF8 should accept
»=encoding UTF-8«, too.
Patch applies cleanly against v1.0.3 with the command
git apply *.patch
Subject: | 0001-also-accept-IANA-preferred-name-UTF-8.patch |
From ab898395fa5d7de9ded6cbcf536bfbbd52ce90b5 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Lars=20D=C9=AA=E1=B4=87=E1=B4=84=E1=B4=8B=E1=B4=8F=E1=B4=A1=20=E8=BF=AA=E6=8B=89=E6=96=AF?= <daxim@cpan.org>
Date: Tue, 1 Dec 2009 15:13:03 +0100
Subject: [PATCH] also accept IANA preferred name: UTF-8
---
.../Documentation/RequirePODUseEncodingUTF8.pm | 2 +-
t/Documentation/RequirePODUseEncodingUTF8.run | 15 +++++++++++++++
2 files changed, 16 insertions(+), 1 deletions(-)
diff --git a/lib/Perl/Critic/Policy/Documentation/RequirePODUseEncodingUTF8.pm b/lib/Perl/Critic/Policy/Documentation/RequirePODUseEncodingUTF8.pm
index 7b37768..2241b34 100644
--- a/lib/Perl/Critic/Policy/Documentation/RequirePODUseEncodingUTF8.pm
+++ b/lib/Perl/Critic/Policy/Documentation/RequirePODUseEncodingUTF8.pm
@@ -12,7 +12,7 @@ use List::MoreUtils qw{ any };
use Perl::Critic::Utils qw{ :severities };
use base 'Perl::Critic::Policy';
-my $ENCODING_REGEX = qr/ ^ =encoding \s+ utf8 /xms;
+my $ENCODING_REGEX = qr/ ^ =encoding \s+ (?i:utf)-?8 /xms;
my $DESCRIPTION = 'POD does not include "=encoding utf8" declaration';
## no critic (ValuesAndExpressions::RestrictLongStrings)
my $EXPLANATION =
diff --git a/t/Documentation/RequirePODUseEncodingUTF8.run b/t/Documentation/RequirePODUseEncodingUTF8.run
index 5b6e362..867eba2 100644
--- a/t/Documentation/RequirePODUseEncodingUTF8.run
+++ b/t/Documentation/RequirePODUseEncodingUTF8.run
@@ -43,6 +43,21 @@ Blah
=cut
+## name Some POD with encoding (Encode alias)
+## failures 0
+## cut
+
+# Blah
+$x = 1;
+
+=pod
+
+=encoding UTF-8
+
+Blah
+
+=cut
+
## name Some POD without any code with encoding
## failures 0
## cut
--
1.6.4.2