Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical

Perldoc Problem: Linux or Perl?

by Ovid (Cardinal)
on Mar 16, 2003 at 16:21 UTC ( #243485=perlquestion: print w/replies, xml ) Need Help??

Ovid has asked for the wisdom of the Perl Monks concerning the following question:

I recently upgraded to RH Linux 8.0 and perldoc seems to be displaying escape sequences. It runs just fine, but output appears as follows

$ perldoc Class::DBI

Class::DBI(3)         User Contributed Perl Documentation        Class::DBI(3)

               Class::DBI - Simple Database Abstraction

               package Music::DBI;
               use base 'Class::DBI';
               Music::DBI->set_db('Main', 'dbi:mysql', 'username', 'password');

(Note that "ESC" is actually white text on a black background).

Frankly, I haven't a clue on how to debug this. Is this a general Linux issue? My man pages appear fine. General info:

  • This is perl, v5.8.0 built for i686-linux-thread-multi
  • GNU bash, version 2.05b.0(1)-release (i686-pc-linux-gnu)

A quick discussion in the chatterbox has revealed that I am not the only monk to have this problem. Petruchio notes that he has a similar problem and redirecting the output to a file and examining it with a hex editor reveals that the escape sequences appear to be properly formed.

I can get around this with perldoc -t module_name, but it would be nice to get this working.


New address of my CGI Course.
Silence is Evil (feel free to copy and distribute widely - note copyright text)

Replies are listed 'Best First'.
Re: Perldoc Problem: Linux or Perl?
by jasonk (Parson) on Mar 16, 2003 at 16:54 UTC

    This is a bug in the way perldoc interacts with groff (it first appeared in Red Hat Linux 8.0, becuase this is the first version with UTF-8 support), it is fixed in the latest rawhide version of Red Hat Linux (which means the fix will be in the next release), but in the meantime the easiest way to work around it is to set the environment variable LESS to 'isr'.

    There are several ways you can do this:

    For bash, add to your .bashrc: export LESS='isr'

    For csh or tcsh, add your .cshrc or .tcshrc: setenv LESS isr

    Or you can just specify it on the command line when you run perldoc: LESS=isr perldoc perlop

    Update: I should mention that only the -r option is really necessary to fix this problem, I just used -isr because that's what I have in my own settings, -i tells less to be case-insensitive when searching, and -s says to compress runs of multiple blank lines to a single blank line. The -r option causes the formatting escape codes to be passed through directly to the terminal.

    Update: Oops, has nothing to do with UTF-8, it's caused by new options in groff... The entry has some more information.

    We're not surrounded, we're in a target-rich environment!
      I can't find the link - but I've read recently somwhere that interpreting escape sequences might be a security risk when you browse for example log files where there is data from external sources.
Re: Perldoc Problem: Linux or Perl?
by Elian (Parson) on Mar 16, 2003 at 16:30 UTC
    Check your pager switch environment variable. Might be that less is getting different switches set (or old switch settings were lost) because of the upgrade.
Re: Perldoc Problem: Linux or Perl?
by allolex (Curate) on Mar 16, 2003 at 23:28 UTC

    I hate to say this, but at least on my system, this problem has something to do with KDE, not with perldoc. KDE appears to have been misconfigured by Redhat so that it displays a number of escaped characters, in particular "-", as box-thingies (I do believe that is the technical term).

    Try this experiment: do ctrl-alt-whatever and pull up a console. Check there. Now start gnome-terminal and check its output. On my system, the problem only exists in Konsole (and in xterm if you don't start it with the -u8 parameter).

    And more specifically, the problem occurs with anything man-formatted in Konsole. Unfortunately, I'm not where to go from here except to check the Konsole docs to see if there's a UTF-8 setting that will fix it. I'll get back to you before the bitterness that is the whole KDE-under-Redhat debate bears its ugly fruit.

    Surprised to read that your man pages are fine.


      It has nothing to do with KDE vs. GNOME, it's a bug in less-378-7/groff-1.18.1-20, if you upgrade to the latest version of those two packages from rawhide, the problem will go away.

      We're not surrounded, we're in a target-rich environment!

        Thanks for the advice, and the problem did go away. That still leaves the question open as to why perldoc and man ouput was formatted correctly under gnome-terminal and xterm, and not under konsole (and putty over ssh, apparently). It still looks a lot like Redhat had a workaround for Gnome and not for KDE, since it worked correctly in those environments before updating.

        Update: added text in italics above.


      I don't think that the problem is restricted to Kconsole as I get the "...displays a number of escaped characters, in particular "-", as box-thingies..." when I use putty to ssh into a freshly installed Redhat 8 box.

      Ben Marsh

Log In?

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://243485]
Approved by pfaut
Front-paged by jasonk
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others imbibing at the Monastery: (2)
As of 2023-05-29 06:04 GMT
Find Nodes?
    Voting Booth?

    No recent polls found