Commit | Line | Data |
---|---|---|
1a67fee7 HS |
1 | package Pod::Perldoc::ToText; |
2 | use strict; | |
3 | use warnings; | |
4 | ||
0909e3f8 | 5 | use vars qw($VERSION); |
37279817 | 6 | $VERSION = '3.21'; |
0909e3f8 RS |
7 | |
8 | use parent qw(Pod::Perldoc::BaseTo); | |
1a67fee7 HS |
9 | |
10 | sub is_pageable { 1 } | |
11 | sub write_with_binmode { 0 } | |
12 | sub output_extension { 'txt' } | |
13 | ||
14 | use Pod::Text (); | |
15 | ||
16 | sub alt { shift->_perldoc_elem('alt' , @_) } | |
17 | sub indent { shift->_perldoc_elem('indent' , @_) } | |
18 | sub loose { shift->_perldoc_elem('loose' , @_) } | |
19 | sub quotes { shift->_perldoc_elem('quotes' , @_) } | |
20 | sub sentence { shift->_perldoc_elem('sentence', @_) } | |
21 | sub width { shift->_perldoc_elem('width' , @_) } | |
22 | ||
23 | sub new { return bless {}, ref($_[0]) || $_[0] } | |
24 | ||
25 | sub parse_from_file { | |
26 | my $self = shift; | |
0909e3f8 | 27 | |
1a67fee7 HS |
28 | my @options = |
29 | map {; $_, $self->{$_} } | |
30 | grep !m/^_/s, | |
31 | keys %$self | |
32 | ; | |
0909e3f8 | 33 | |
1a67fee7 HS |
34 | defined(&Pod::Perldoc::DEBUG) |
35 | and Pod::Perldoc::DEBUG() | |
36 | and print "About to call new Pod::Text ", | |
37 | $Pod::Text::VERSION ? "(v$Pod::Text::VERSION) " : '', | |
38 | "with options: ", | |
39 | @options ? "[@options]" : "(nil)", "\n"; | |
40 | ; | |
41 | ||
42 | Pod::Text->new(@options)->parse_from_file(@_); | |
43 | } | |
44 | ||
45 | 1; | |
46 | ||
47 | =head1 NAME | |
48 | ||
49 | Pod::Perldoc::ToText - let Perldoc render Pod as plaintext | |
50 | ||
51 | =head1 SYNOPSIS | |
52 | ||
53 | perldoc -o text Some::Modulename | |
54 | ||
55 | =head1 DESCRIPTION | |
56 | ||
57 | This is a "plug-in" class that allows Perldoc to use | |
58 | Pod::Text as a formatter class. | |
59 | ||
60 | It supports the following options, which are explained in | |
61 | L<Pod::Text>: alt, indent, loose, quotes, sentence, width | |
62 | ||
63 | For example: | |
64 | ||
65 | perldoc -o text -w indent:5 Some::Modulename | |
66 | ||
67 | =head1 CAVEAT | |
68 | ||
69 | This module may change to use a different text formatter class in the | |
70 | future, and this may change what options are supported. | |
71 | ||
72 | =head1 SEE ALSO | |
73 | ||
74 | L<Pod::Text>, L<Pod::Perldoc> | |
75 | ||
76 | =head1 COPYRIGHT AND DISCLAIMERS | |
77 | ||
78 | Copyright (c) 2002 Sean M. Burke. All rights reserved. | |
79 | ||
80 | This library is free software; you can redistribute it and/or modify it | |
81 | under the same terms as Perl itself. | |
82 | ||
83 | This program is distributed in the hope that it will be useful, but | |
84 | without any warranty; without even the implied warranty of | |
85 | merchantability or fitness for a particular purpose. | |
86 | ||
87 | =head1 AUTHOR | |
88 | ||
0909e3f8 | 89 | Current maintainer: Mark Allen C<< <mallen@cpan.org> >> |
91a46224 AF |
90 | |
91 | Past contributions from: | |
0909e3f8 RS |
92 | brian d foy C<< <bdfoy@cpan.org> >> |
93 | Adriano R. Ferreira C<< <ferreira@cpan.org> >>, | |
94 | Sean M. Burke C<< <sburke@cpan.org> >> | |
91a46224 | 95 | |
1a67fee7 HS |
96 | |
97 | =cut | |
a6b91202 | 98 |