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

I have various perls on my Windows machine, and I've noticed that the output from perldoc in versions 5.8.? is not formatted as nicely as that from perldoc in version 5.6.?. In the 5.8.? case, the output wraps across lines in a way that Unix/Linux files do in Windows (due to the difference in line termination.) I can send the output to a file and then read that which solves the problem, but I would prefer not to have to do that. I once modified an old perldoc to work in the newer versions, and that seemed to fix the problem, but I'm not sure that the modified perldoc works properly in all cases (the workings of perldoc are a little confusing to me...)
I was wondering if anyone has any comments/suggestions about all this. Thanks!
chas

Replies are listed 'Best First'.
Re: Perldoc output differences
by brian_d_foy (Abbot) on Feb 17, 2005 at 17:46 UTC

    Things change between releases. In this case, the difference is probably that perldoc has been re-written and now comes from the Pod::Perldoc package. Indeed, here's all of perldoc:

    #!/usr/bin/perl eval 'exec /usr/bin/perl -S $0 ${1+"$@"}' if 0; # This "perldoc" file was generated by "perldoc.PL" require 5; use Pod::Perldoc; BEGIN { $^W = 1 if $ENV{'PERLDOCDEBUG'} } exit( Pod::Perldoc->run() );

    If you have a problem, you can send a bug report to the maintainer (hopefully with a patch). Good luck :)

    --
    brian d foy <bdfoy@cpan.org>
Re: Perldoc output differences
by hsinclai (Deacon) on Feb 17, 2005 at 17:51 UTC
    Maybe see if perldoc -t eliminates any differences.. it's still nicely legible across the board..

      OP is on windows, so, from perldoc (v3.12):

      -t   Display pod using pod2text instead of pod2man and nroff
            (-t is the default on win32 unless -n is specified)

      or did poster of immediate-parent have something in mind I missed?

Re: Perldoc output differences
by chas (Priest) on Feb 17, 2005 at 21:33 UTC
    Thanks for the responses. perldoc -t doesn't seem to change anything. On my Windows system, perldoc seems to be perldoc.bat which is a quite long confusing file. I have tried editing (a copy) of that with some success, but I thought I shouldn't have to do that.
    The output of perldoc can't be sent to a file by e.g.
    perldoc perldoc > perldoc.txt
    which seems strange to me (although I can achieve such a result in a different way.)
    Perhaps it is something about my machines. I am running Windows 98 on 2 similar machines. On one of them backquotes doesn't seem to work correctly; @dir=`dir` causes the directory listing to be printed to the screen but @dir receives nothing. (I mention this because I tried to rewrite perldoc by capturing the output with backquotes and then filtering that in some way.) I guess I will switch to Linux one of these days.
    chas
Re: Perldoc output differences
by chas (Priest) on Feb 21, 2005 at 03:09 UTC
    Just a final note about perldoc on Windows: I looked at some old comp.lang.perl.misc posts and found various comments about this. The problem seems to be that "v5.8.0 perldoc writes it's temp file as binary, so the end of line isn't adapted to the platform...Win98's more.com can't handle this" One solution is to install the module Pod::Perldoc which has its own Perldoc.pm and perldoc. Another solution is to: set PAGER="c:\program files\accessories\wordpad.exe" (This works and is rather nice in that one can move around in the output.) Finally, I once wrote the following script which is basically a wrapper around perldoc (it seems to cure the end of line problem and also saves the output in a file "tmp" which can be opened in an editor if desired):
    $args=""; while ($x=shift){$args.=" $x";} $cmdstring=qq/perl -e "system \\\"perldoc $args\\\"" > tmp/; system $cmdstring; open F,"<tmp"; system "more tmp";
    (This can be made into a batch file using pl2bat.) It's perhaps a bit silly, but I use perldoc constantly, and was rather frustrated by the hard to read output. By the way, there doesn't seem to be a problem on later versions of Windows (e.g. XP.)
    chas