http://www.perlmonks.org?node_id=968203


in reply to strange output characters from perldoc

G'day dbae,

I have the same problem using Mac OS X 10.7.3 and Perl 5.14.2 with the Mac application Terminal. I've used a number of different OSes over the years and haven't seen this issue previously: this suggests a Mac OS X problem; although, it could be related to just the perldoc implementation on Mac OS X.

I use ANSI escape codes in $PS1 and $PS2 and these seem to work perfectly. From my .bash_profile:

PS1='\[\033[0;36m\]\u@\h: \w\n\$ \[\033[0m\]' PS2='\[\033[0;36m\]> \[\033[0m\]'

While fixing this is on my TODO list, it has a fairly low priority as I tend to use http://perldoc.perl.org in preference to the commandline perldoc. Looking for a quick fix some months ago, I investigated $TERM values (suggested above) as well as $LANG and $LC_* (locale) values. I didn't find a solution in whatever timeframe I allotted but these are areas I would be researching further in the future: perhaps that's of some use to you.

-- Ken

Replies are listed 'Best First'.
Re^2: strange output characters from perldoc
by Anonymous Monk on May 15, 2013 at 02:02 UTC

    Try looking at your PAGER environment variable. Mine was set to "more" and it was messing up from the output from perldoc (although normal "man" worked fine). I switched PAGER to be "less -R" and now perldoc looks good.

    This is using xterm on FreeBSD, FWIW.

      ++ Thanks! I had less; less -R is a vast improvement.

      -- Ken

      Perfect. This solved my problem too! My term was xterm-256color and man worked fine, although perldoc had escape sequences just like described here. setting my PAGER to less -R solved it for me!!! Thank you!!
Re^2: strange output characters from perldoc
by Anonymous Monk on May 01, 2012 at 06:45 UTC

    although, it could be related to just the perldoc implementation on Mac OS X.

    No, no it couldn't, see for yourself