Subject: | Fix podlators to check for unicode layers correctly |
This patch makes Pod::Text and Pod::Man check for unicode layers the
hard way. The current method is not compatible with some of the changes
we're planning to do for 5.17.0. This has to be changed to fix some long
standing issues with :utf8.
Leon
Subject: | podlators.patch |
commit a91755a7431c8070ca7c8b0de21995d611d9350d
Author: Leon Timmermans <fawaka@gmail.com>
Date: Mon Apr 9 10:27:53 2012 +0200
Fix podlators to check for unicode layers correctly
diff --git a/lib/Pod/Man.pm b/lib/Pod/Man.pm
index 96f3fcc..947fb04 100644
--- a/lib/Pod/Man.pm
+++ b/lib/Pod/Man.pm
@@ -753,8 +753,8 @@ sub start_document {
if ($$self{utf8}) {
$$self{ENCODE} = 1;
eval {
- my @layers = PerlIO::get_layers ($$self{output_fh});
- if (grep { $_ eq 'utf8' } @layers) {
+ my $flag = (PerlIO::get_layers($$self{output_fh}, output => 1, details => 1))[-1];
+ if ($flag & PerlIO::F_UTF8()) {
$$self{ENCODE} = 0;
}
}
diff --git a/lib/Pod/Text.pm b/lib/Pod/Text.pm
index cc02820..1b78c80 100644
--- a/lib/Pod/Text.pm
+++ b/lib/Pod/Text.pm
@@ -298,8 +298,8 @@ sub start_document {
if ($$self{opt_utf8}) {
$$self{ENCODE} = 1;
eval {
- my @layers = PerlIO::get_layers ($$self{output_fh});
- if (grep { $_ eq 'utf8' } @layers) {
+ my $flag = (PerlIO::get_layers($$self{output_fh}, output => 1, details => 1))[-1];
+ if ($flag & PerlIO::F_UTF8()) {
$$self{ENCODE} = 0;
}
};