I'm looking for the proper setting for $term/$TERM for use in windows in XQuartz. Neither xterm nor vt100 work well. They do display plain text okay, but they have trouble when I try to use some non-plain text.
man pages usually display okay, but sometimes they have problems. (Unfortunately, I can't think of a good bad example at the moment.)
Right now, I'm seeing this when I try to display POD. Here's some simple pod and some perldoc runs with different $term settings:
iolaire(100)> cat podtest
#!/usr/bin/env perl
1;
=pod
=head1 NAME
B<podtest> - podtest for pod output on shell
=head1 SYNOPSIS
podtest
=head1 DESCRIPTION
B<podtest> is pod test.
=cut
iolaire(101)> set term=vt100
iolaire(102)> perldoc podtest
2ESC[1mNAME2ESC[0m
2ESC[1mpodtest2ESC[0m - podtest for pod output on shell
2ESC[1mSYNOPSIS2ESC[0m
podtest
2ESC[1mDESCRIPTION2ESC[0m
2ESC[1mpodtest2ESC[0m is pod test.
iolaire(103)> set term=xterm
iolaire(104)> perldoc podtest
iolaire(105)> perldoc podtest | cat -v
^[[1mNAME^[[0m
^[[1mpodtest^[[0m - podtest for pod output on shell
^[[1mSYNOPSIS^[[0m
podtest
^[[1mDESCRIPTION^[[0m
^[[1mpodtest^[[0m is pod test.
iolaire(106)>
I have had the same problem in tcsh and in bash.
Perldoc used to work fine on xterms on OSX. A few years ago this behavior started and I've finally gotten fed up with it and am trying to get it working again. (Perldoc, some man pages, and um, a few other things in which I've seen this problem.)
Thanks so much for the help!
versions: XQuartz 2.7.11; OSX 10.13.4; Perl v5.26.2; Perldoc v3.28
short: the problem is likely in how your pager (e.g., less) is being invoked.
long: perldoc uses hard-coded escapes via Pod::Text::Color and in turn Term::ANSIColor, e.g.,
and since all of the moving parts are buried away within the perl library, there's not much that you could have done to break this. Unlike a few other perl modules, this one appears to ignore the value for
TERM
.On the other hand, perldoc uses for pager. It's manual page says
If you happened to set
PAGER
toless
, then it will use that value. Butless
will display escape characters as shown in your example unless you add an option to the command, e.g.,-R
. Doing that toPAGER
is likely to interfere with other applications, soperldoc
looks first for its own variablePERLDOC_PAGER
.