Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling
 
PerlMonks  

workaround to fix perldoc

by LanX (Saint)
on Mar 16, 2019 at 12:22 UTC ( [id://1231336]=perlquestion: print w/replies, xml ) Need Help??

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

Hi

My dev environnement is stuck on 5.24 for Windows and perldoc is buggy and fails parsing the options.

I didn't bother so far because I could use the web.

But I seem to remember that there was a workaround to make it work.

please help my undercaffeinated brain. :)

edit

Not sure anymore if it's a general bug or just my environment.

Cause this describes another problem Re^2: What is perldoc -lf doing?

update

my workaround now is to call

> perldoc perlrun |more

or

> perldoc -T perlrun

since the error I get is in German, the problem may be related in the way the pager "more" is called internally.

> perldoc perlrun Unzulässiger Parameter - -R

Cheers Rolf
(addicted to the Perl Programming Language :)
Wikisyntax for the Monastery FootballPerl is like chess, only without the dice

Replies are listed 'Best First'.
Re: workaround to fix perldoc -- Jenda's macro
by Discipulus (Canon) on Mar 16, 2019 at 14:15 UTC
    Hello LanX,

    I can confirm that is buggy in 5.24 strawberry..

    io@COMP:c>perldoc -V Perldoc v3.27, under perl v5.024001 for MSWin32 io@COMP:c>perldoc -f seek Parametro non valido - -R

    It runs ok in 5.28

    io@COMP:C>perldoc -V Perldoc v3.2801, under perl v5.028001 for MSWin32 io@COMP:C>perldoc -f seek seek FILEHANDLE,POSITION,WHENCE [...] -- More --

    Strange I never noticed: I use it.. but probably I never noticed because I use the ancient Jenda's macro everytime since 2010 ;) dunno if you was refering to this one..

    pdoc=perldoc -o html -T -w index $* > %TEMP%\perldoc_temp.html && start %TEMP%\perldoc_temp.html

    Windows macros are ridicule things and do you need to reload the file (if you have them in file) everytime to have them applied. You can modify the link to your cmd.exe to use doskey with the above macro specified or a file to read.

    L*

    There are no rules, there are no thumbs..
    Reinvent the wheel, then learn The Wheel; may be one day you reinvent one of THE WHEELS.
      Thanks, it's activestate in my case and I came up with an alias too

      doskey perldoc=perldoc -T $* ^| more

      But I'm still not a fan of more , missing all the options less offers.

      Now trying to create an texinfo output and render the output in emacs as pager

      Cheers Rolf
      (addicted to the Perl Programming Language :)
      Wikisyntax for the Monastery FootballPerl is like chess, only without the dice

        > Now trying to create an texinfo output and render the output in emacs as pager

        emacs has a built-in man renderer called "woman".

        The following elisp function renders the pod as man and displays it (with meta informations) inside emacs. Tested on windows.

        This is far from perfect and meant as a start (release often ... yadda).

        The PDE project seems to have more elaborated code, not sure how it blends into cperl-modes code.

        (defun perldoc-woman (target) "perldoc displayed via woman" (interactive) (let* ( (buffer-name (concat "*perldoc-" target "*")) (perl-cmd (concat "perl C:/Perl_524/bin/perldoc -MPod::Man " targ +et)) ) (switch-to-buffer (get-buffer-create buffer-name)) (erase-buffer) (shell-command perl-cmd 1) (woman-process-buffer) (list buffer-name perl-cmd) ;dbg ) )

        Please note that you can use emacsclient --eval to send elisp code to emacs and display inside the terminal (option '-nw') if needed.

        Cheers Rolf
        (addicted to the Perl Programming Language :)
        Wikisyntax for the Monastery FootballPerl is like chess, only without the dice

Re: workaround to fix perldoc
by VinsWorldcom (Prior) on Mar 16, 2019 at 19:49 UTC

    I have Git for Windows and "less" from GNUWin32 installed so use "less" as my pager. The GNUWin32 version handles Windows better than the Git for Windows "less" version. In any case, PerlDoc doesn't work well with it, so my fix:

    # Perldoc paging using less: create: c:\strawberry\perl\bin\perldoc (without extension) Then, in Pod::Perldoc search for "-R" and comment out or put an if {} around, e.g., if ( $^O ne 'MSWin32' ) { BLOCK }

    My problem stemmed from a command line option to "less" that my "less.exe" didn't support, so it was just printing the whole POD at once with an error as well. Now, 'perldoc ARG' produces the PerlDoc for "ARG" (whatever it may be) using the "less" pager.

    Hope that helps.

      You nailed it, thanks! =)

      This -R option is responsible for the problems on windows since the pager "more" can't handle "-R".

      commenting out this line (#1941 for me)

      #local $ENV{MORE} = defined $ENV{MORE} ? "$ENV{MORE} -R" : "-R";

      fixed the win-bug for me.

      Apparently this was added to fix unicode problems on linux, ignoring that Win has it's own "more" pager.

      For those who wonder how to find Pod::Perldoc in their local installation

      >perldoc -l Pod::Perldoc C:\Perl_524\lib\Pod\Perldoc.pm

      does the trick, even with corrupt pager options.

      Cheers Rolf
      (addicted to the Perl Programming Language :)
      Wikisyntax for the Monastery FootballPerl is like chess, only without the dice

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://1231336]
Approved by Athanasius
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others browsing the Monastery: (4)
As of 2024-04-19 04:12 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found