No problem here - just solved a problem and thought I would post the solution here so that others might not waste the time that I did.

After working on *nix for the last several years I got used to invoking "perldoc" at the command prompt and having the "less" pager function display the perldoc text. This is nice because "less" give you much more power than the standard Windows "more" pager function. With "less", you can search through the text being displayed, and use the Page Down and Page Up buttons to scroll forwards and backwards through the text. Can't do those things with "more".

So now that I'm on Windows XP, I've been having the hardest time trying to get "less" functionality in "perldoc" so that I can *search* the perldoc text. With an excellent example from Jeff Zucker I've been working on a CGI script that will display the perldocs in the browser which works fine for the example "perldoc DBI", but I've been having problems getting the cgi script to display output for "perldoc perl".

Anyway, I just solved the "less" problem - here are the steps I took:
1. download the "less" utility from
- I downloaded the Sources Setup package and ran that and installed "less" to C:\Program Files\GnuWin32 (it installs "less.exe" in the \bin directory) 2. In Control Panel, dbl-click on "System", then click on the "Advanced" tab, and then on the "Environment Variables" button at the bottom. Here I added 2 new "User variables" called PATH and PAGER: PATH C:\Program Files\GnuWin32\bin;%PATH% PAGER "C:\Program Files\GnuWin32\bin\less.exe" 3. Click "Ok" on the Environment Variables dialog 4. Click "Ok" on the "Advanced" tab 5. Exit out of any open Command Prompt windows 6. Bring up a new Command Prompt window, and enter perldoc perl Your should now be able to use - Page Down button (on the keyboard) - Page Up button (on the keyboard) - Search - using the forward slash "/" * if I wanted to search for all occurrences of the word "perl", then I would do "/perl" and press Enter. You should see each occurrence of "perl" hightlighted. Press "n" to advance to the "n"ext occurrence.
Hopefully I haven't left anything out, and I hope at least someone finds this useful besides me ;-)

Replies are listed 'Best First'.
Re: perldoc on WinXP - with "less" instead of "more"
by jZed (Prior) on Jun 29, 2004 at 17:11 UTC
    In addition to "less", there are a bunch of other *nix utilities that really help (how can someone live without cat?). I haven't compared the GNU utils lately to the Cygwin ones, but Cygwin is very complete. You can install Cygwin very easily (has its own installer now) then just ignore Cygwin (i.e. don't use its bash shell, use your regular Win console) and you'll have access to all the utils as long as cygwin/bin is in your path.

    Another tip: if you can, ditch IIS and install Apache - you'll get a wider group of monks able to help you troubleshoot server issues that way.

      Cygwin is the GNU utils. Often a few versions behind, but it's the same stuff.

      ----
      send money to your kernel via the boot loader.. This and more wisdom available from Markov Hardburn.

      Great idea on Cygwin! That's next on my Windows to-do list. Can't do on the switch to Apache - I don't have a choice on that one - IIS it has to be (at least for now).
Re: perldoc on WinXP - with "less" instead of "more"
by Brutha (Friar) on Jun 30, 2004 at 09:26 UTC
    There is another package, which contains most Unix-Utilities including less for Windows. It is found under http://unxutils.sourceforge.net/ and is independent of any DLLs. I use it now about three years under NT and W2K without problems.

    And it came to pass that in time the Great God Om spake unto Brutha, the Chosen One: "Psst!"
    (Terry Pratchett, Small Gods)

      Ditto++. And by avoiding the cygwin layers, they're faster to boot and easier to tweak.


      Examine what is said, not who speaks.
      "Efficiency is intelligent laziness." -David Dunham
      "Think for yourself!" - Abigail
      "Memory, processor, disk in that order on the hardware side. Algorithm, algoritm, algorithm on the code side." - tachyon
      Brutha wrote:
      and is independent of any DLLs

      I went back and forth in my head for a while deciding whether to say anything about this or not. I know I'm going to be d/v'ed, that's a foregone conclusion. I just suppose that its the cumulative experience I have in PMo discussions that leads me to open my mouth.

      There's a lot of misunderstanding regarding MSWindows and projects that port Perl and other *NIX tools to it, here amongst Perlmonks. I'd estimate that less than 10% of the Monks who open their yaps on such topics actually understand everything they're talking about. {Downvote me NOW, please, and get on with the next node}.

      Those *NIX tools are sure not "independent of any DLLs". They are dependent on MSVCRT.DLL. If this file isn't present, they aren't going to work. It's a "native" MSWindows DLL that Cygwin "replaces" (the role, not the actual file) with a "cygwin.dll".

      GnuWin32 != Cygwin
      unxutils != GnuWin32 != Cygwin
      mingw  !=  GnuWin32 != Cygwin
      

      • Cygwin is (largely) GNU software ported to the Cygwin psuedo-platform (linking to the C library CYGWIN.DLL)
      • GnuWin32 is (largely) GNU software ported to compile with GNU tools on the MSWin32 platform (linking to the C library MSVCRT.DLL) using the mingw toolset.
      • MinGW32 is the development platform begun for porting *NIX applications to run with linkage to only the native MSWindows C library "MSVCRT.DLL". It's now also used by people who hardly know what "GNU" means, however. It is GNU gcc, and all the binutils, and a large collection of system headers, and more. It started as an outgrowth of Cygwin. People say/write mingw and MinGW and MinGW32 interchangeably, but to me "mingw" is the entire collection of software and the community that supports it; "MinGW32" is the build platform (what to target C Preprocessor defines to, etc.). Obviously "32" refers to "32-bit" and someday there could be a MinGW64.
      • unxutils is out there in left field: who knows how they build their apps, they likely use Borland or MSVC or maybe sometimes MinGW by now. They don't document (Mailing Lists, etc.) like MinGW or Cygwin, and using their binary builds is fine if it works for you, but to me its a gamble and a short-sighted strategy. IMHO.

      Hopefully it is a little clearer now. I'd like to see some of the superstition and half-truths prevalent in the Monastery community dispelled wrt Cygwin and the rest of this. Of course for that to really happen, Monks will have to become interested in something besides Perl. I know that few Monks listen to me, because I'm not "nice" and meek and mild-mannered.

        s/cygwin.dll/cygwin1.dll/gi

        It's not just that dll, either. The cygwin gcc uses these:

        Found: C:\cygwin\bin\gcc.exe C:/cygwin/bin/gcc.exe C:\cygwin\bin\cygwin1.dll C:\WINDOWS\System32\ADVAPI32.DLL C:\WINDOWS\System32\ntdll.dll C:\WINDOWS\System32\KERNEL32.dll C:\WINDOWS\System32\RPCRT4.dll C:\cygwin\bin\cygintl-2.dll C:\cygwin\bin\cygiconv-2.dll

        More and more things in cygwin will rely not just on the dll, but on the cygserver service running as time goes on.

Re: perldoc on WinXP - with "less" instead of "more"
by Not_a_Number (Prior) on Jun 29, 2004 at 17:26 UTC

    For some reason, I couldn't get this to work as such on my WinXP machine. In case anyone else has similar problems, I downloaded the zip archive from http://www.greenwoodsoftware.com/less/download.html, which, once unzipped, and when I had adjusted my environment variables, works perfectly.

    Thanks for the tip hmerrill++ !

    dave

Re: perldoc on WinXP - with "less" instead of "more"
by BUU (Prior) on Jun 29, 2004 at 17:06 UTC
    Thats pretty cool. I'm suprised it's so easy to set up the PAGER, I wonder what else uses %PAGER%.