in reply to Strawberry/ActiveState Perl 5.24.1 - Invalid parameter - -R error when invoking perldoc [Resolved]

SO IT'S NOT JUST ME!!!

I don't think I've seen that exact issue, but did notice perldoc behaved differently for me between 5.18 and 5.22.

I'm on Windows 7 x64 with Strawberry 64-bit versions as described above. I also have GnuWin32 utils installed - including less.exe. I use less.exe as my pager by setting PAGER=less in my Windows environment variables. Less.exe along with other GnuWin32 utils are in C:\usr\bin, which is in my path.

On 5.18, 'perldoc SOMETHING' worked fine and used less.exe to page. On 5.22, 'perldoc SOMETHING' would just act like 'cat' and spit out the entire POD document scrolling off the screen - not even using 'more'. I started digging and found 2 differences in Pod::Perldoc.

First is that it's looking for 'perldoc' to exist in 'c:\strawberry\perl\bin', which of course it doesn't - 'perldoc.BAT' exists. So I created a file called 'perldoc' (no extension) which is just 'perldoc.BAT' minus the Windows batch commands so that it's just a regular Perl script.

Next, looking in Pod::Perldoc (C:\strawberry\perl\lib\Pod\Perldoc.pm), I found line 1933:

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

-R!!! It's essentially overriding my PAGER=less setting and providing the -R as an option to less.exe to "fix some bug" as documented in line 1932. Of course running 'less -R' from a command prompt in Windows fails for me:

VinsWorldcom@C:\Users\VinsWorldcom> less -R There is no -R option ("less --help" for help)

I updated to the latest GnuWin32 version of less.exe and still no -R support. So I just commented out the line in Pod::Perldoc and now it all works fine like it used to. Running 'perldoc SOMETHING' now uses less.exe as my pager again the way it should.

If you're worried about commenting out the line, you could always wrap it in a conditional - which achieves the same thing:

if ( $^O ne 'MSWin32' ) { ... }

Hopefully, this helps you.

  • Comment on Re: Strawberry/ActiveState Perl 5.24.1 - Invalid parameter - -R error when invoking perldoc
  • Select or Download Code