Subject: | If set 'encoding' command in the middle of pod, 'wide character' warning is output. |
The perlpodspec, it is written as follows about 'encoding' command.
Show quoted text
> This command, which should occur early in the document (at least before any non-US-ASCII data!)
However, when actually writing the following such pod, warning 'wide character' is output by perldoc command.
----------
=pod
=head1 NAME
This is the first ascii text
=over 4
=encoding utf8
=item ⇒This is the first non-ascii text⇐
This is the second ascii text
=cut
----------
This is because the Pod::Text that has been called from perldoc, does not take into account that you want to set the encoding in the middle of a pod.
I think that it should reflect the following modifications.
diff --git a/lib/Pod/Text.pm b/lib/Pod/Text.pm
index 87f9e81..70007c6 100644
--- a/lib/Pod/Text.pm
+++ b/lib/Pod/Text.pm
@@ -277,8 +277,8 @@ sub output {
my $encoding = $$self{encoding} || '';
if ($encoding) {
eval { binmode ($$self{output_fh}, ":encoding($encoding)") };
+ $$self{CHECKED_ENCODING} = 1;
}
- $$self{CHECKED_ENCODING} = 1;
}
if ($$self{ENCODE}) {
print { $$self{output_fh} } encode ('UTF-8', $text);