Sean M. Burke schrieb:
My previous message, about Perldoc, reminded me of the long-forgotten time when I actually wrote Perl under MSWin, and that reminded me:

I have/had some magic thingy under MSWin to make Perldoc by default save output to an RTF temp file and then open Wordpad (as write.exe) on it as a lightweight viewer. (Hm, this:
  http://search.cpan.org/~sburke/Pod-Perldoc/lib/Pod/Perldoc/ToRtf.pm
says that it was simply "set PERLDOC=-ortf")

Anyway, in those ancient days, there were still lots of people running around with write.exe copies that couldn't understand RTF or something, but now, years later, I think that that magic open-with-Wordpad behavior should be the default-- or at least default if Perldoc somehow sees that it's running under XP.
I'm not sure how Cygwin should relate to this.

Well, Cygwin fails with
$ export RTFREADER="cygstart wordpad"
$ PERLDOCDEBUG=3 perldoc -ortf -f unpack

at ToRtf.pm:
sub page_for_perldoc {
  my($self, $tempfile, $perldoc) = @_;
  return unless $perldoc->IS_MSWin32;

because cygwin is not IS_MSWin32 for perldoc.
the default "write.exe" also fails, because of system refusing to start
  About to launch <"write.exe" "/tmp/dkAV0xthSJ">
Can't exec ""write.exe"": No such file or directory at

$ which write.exe
/cygdrive/c/WINDOWS/System32/write.exe
$ export RTFREADER=`which write.exe`

ToRtf::page_for_perldoc: About to launch <"/cygdrive/c/WINDOWS/System32/write.ee" "/tmp/jRmiTn36oc"> Can't exec ""/cygdrive/c/WINDOWS/System32/write.exe"": No such file or directory

So I removed the double quoting
  return 1 if system( qq{$rtf_pager}, qq{$tempfile} ) == 0;

With these two changes it works fine.

And I'm not adverse to having the default be to save to HTML and opening the temp file with a browser. The distinction between opening an RTF temp file in a little Write window and opening an HTML file in the default browser, seems quite minor to me now.


(Of course, the default would be merely a default, easily overrideable with -otext either in the PERLDOC env var or just on the command line; just in case someone particularly wants to joyously page thru plaintext, for some purpose.)


The most recent pondering I can find of this, is this message of mine from years ago:
  http://www.nntp.perl.org/group/perl.pod-people/700
and the ten or so messages that follow it.
You will note the extreme datedness of the considerations there, including, notably, the once-important idea of: what if I don't have a browser open, and don't want to wait foreeeever for it to start up?




--
Reini Urban
http://phpwiki.org/  http://murbreak.at/
http://helsinki.at/  http://spacemovie.mur.at/
--- /usr/lib/perl5/5.8/Pod/Perldoc/ToRtf.pm.orig        2005-12-30 
03:05:15.001000000 +0000
+++ /usr/lib/perl5/5.8/Pod/Perldoc/ToRtf.pm     2006-12-08 07:44:00.765625000 
+0000
@@ -19,13 +19,13 @@
 
 sub page_for_perldoc {
   my($self, $tempfile, $perldoc) = @_;
-  return unless $perldoc->IS_MSWin32;
+#  return unless $perldoc->IS_MSWin32;
   
   my $rtf_pager = $ENV{'RTFREADER'} || 'write.exe';
   
   $perldoc->aside( "About to launch <\"$rtf_pager\" \"$tempfile\">\n" );
   
-  return 1 if system( qq{"$rtf_pager"}, qq{"$tempfile"} ) == 0;
+  return 1 if system( qq{$rtf_pager}, qq{$tempfile} ) == 0;
   return 0;
 }
 

Reply via email to