| 1 | |
| 2 | require 5; |
| 3 | package Pod::Perldoc::ToRtf; |
| 4 | use strict; |
| 5 | use warnings; |
| 6 | use vars qw($VERSION); |
| 7 | |
| 8 | use base qw( Pod::Simple::RTF ); |
| 9 | |
| 10 | $VERSION # so that ->VERSION is happy |
| 11 | # stop CPAN from seeing this |
| 12 | = |
| 13 | $Pod::Simple::RTF::VERSION; |
| 14 | |
| 15 | |
| 16 | sub is_pageable { 0 } |
| 17 | sub write_with_binmode { 0 } |
| 18 | sub output_extension { 'rtf' } |
| 19 | |
| 20 | sub page_for_perldoc { |
| 21 | my($self, $tempfile, $perldoc) = @_; |
| 22 | return unless $perldoc->IS_MSWin32; |
| 23 | |
| 24 | my $rtf_pager = $ENV{'RTFREADER'} || 'write.exe'; |
| 25 | |
| 26 | $perldoc->aside( "About to launch <\"$rtf_pager\" \"$tempfile\">\n" ); |
| 27 | |
| 28 | return 1 if system( qq{"$rtf_pager"}, qq{"$tempfile"} ) == 0; |
| 29 | return 0; |
| 30 | } |
| 31 | |
| 32 | 1; |
| 33 | __END__ |
| 34 | |
| 35 | =head1 NAME |
| 36 | |
| 37 | Pod::Perldoc::ToRtf - let Perldoc render Pod as RTF |
| 38 | |
| 39 | =head1 SYNOPSIS |
| 40 | |
| 41 | perldoc -o rtf Some::Modulename |
| 42 | |
| 43 | =head1 DESCRIPTION |
| 44 | |
| 45 | This is a "plug-in" class that allows Perldoc to use |
| 46 | Pod::Simple::RTF as a formatter class. |
| 47 | |
| 48 | This is actually a Pod::Simple::RTF subclass, and inherits |
| 49 | all its options. |
| 50 | |
| 51 | You have to have Pod::Simple::RTF installed (from the Pod::Simple dist), |
| 52 | or this module won't work. |
| 53 | |
| 54 | If Perldoc is running under MSWin and uses this class as a formatter, |
| 55 | the output will be opened with F<write.exe> or whatever program is |
| 56 | specified in the environment variable C<RTFREADER>. For example, to |
| 57 | specify that RTF files should be opened the same as they are when you |
| 58 | double-click them, you would do C<set RTFREADER=start.exe> in your |
| 59 | F<autoexec.bat>. |
| 60 | |
| 61 | Handy tip: put C<set PERLDOC=-ortf> in your F<autoexec.bat> |
| 62 | and that will set this class as the default formatter to run when |
| 63 | you do C<perldoc whatever>. |
| 64 | |
| 65 | =head1 SEE ALSO |
| 66 | |
| 67 | L<Pod::Simple::RTF>, L<Pod::Simple>, L<Pod::Perldoc> |
| 68 | |
| 69 | =head1 COPYRIGHT AND DISCLAIMERS |
| 70 | |
| 71 | Copyright (c) 2002 Sean M. Burke. All rights reserved. |
| 72 | |
| 73 | This library is free software; you can redistribute it and/or modify it |
| 74 | under the same terms as Perl itself. |
| 75 | |
| 76 | This program is distributed in the hope that it will be useful, but |
| 77 | without any warranty; without even the implied warranty of |
| 78 | merchantability or fitness for a particular purpose. |
| 79 | |
| 80 | =head1 AUTHOR |
| 81 | |
| 82 | Sean M. Burke C<sburke@cpan.org> |
| 83 | |
| 84 | =cut |
| 85 | |