While programming using Emacs, you frequently consult manual pages. My environment is text-based Emacs via SSH.

While I can open "Normal" manual pages in Emacs using the man command ((man MAN-ARGS)function), I wonder how to use perldoc for Perl POD documentation from within Emacs: When I run it (e.g.: perldoc -f pack) from a shell ((shell &optional BUFFER) function), I get a message saying:

WARNING: terminal is not fully functional

Specifically, the number of terminal lines is less than what the Emacs windows offers. The terminal seems to be set to dumb, but even when I use TERM=emacs perldoc -f pack only 24 lines are used, and I see a lines 1-23 prompt (pager asking to continue). I also see that LINES is set to 24, even though my (outer) terminal has 103 lines.

Obviously, as the window can be resized, counting the number of lines and setting LINES accordingly does not look like a smart answer for this problem. Despite of that, using TERM=emacs LINES=100 perldoc -f pack still stopped output at line 24.

So maybe it's an Emacs question, actually.

  • Not an answer, but have you considered using tmux or screen so you can have one pane with emacs open and another with a regular shell?
    – terdon
    Dec 5, 2023 at 9:59
  • Also, you can run man perlfunc in emacs, then search for pack T (for "pack TEMPLATE") which takes you to the relevant entry. Is that a good enough workaround?
    – terdon
    Dec 5, 2023 at 10:01
  • @terdon My actual use case was to read the POD for a program I'm developing, and the POD is inside the program that is just in the working directory. So man perlfunc does not actually help.
    – U. Windl
    Dec 5, 2023 at 10:07

1 Answer 1


It seems the solution is rather simple: Just add perldoc's -T option ("This specifies that the output is not to be sent to a pager, but is to be sent directly to STDOUT."):

v04:~/src/Perl/OTP> perldoc -T -f pack
perldoc -T -f pack
            Takes a LIST of values and converts it into a string using the
            rules given by the TEMPLATE. The resulting string is the
            concatenation of the converted values. Typically, each converted
            value looks like its machine-level representation. For example,
            on 32-bit machines an integer may be represented by a sequence
            of 4 bytes, which will in Perl be presented as a string that's 4
            characters long.
                # pack little-endian 16- and 32-bit signed integers
                $foo = pack('(sl)<', -42, 4711);
                # exactly the same

            The same template may generally also be used in unpack().


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .