xref: /openbsd-src/gnu/usr.bin/perl/cpan/Pod-Perldoc/lib/Pod/Perldoc/ToText.pm (revision 9f11ffb7133c203312a01e4b986886bc88c7d74b)
1898184e3Ssthenpackage Pod::Perldoc::ToText;
2898184e3Ssthenuse strict;
3898184e3Ssthenuse warnings;
4898184e3Ssthen
5898184e3Ssthenuse vars qw($VERSION);
6*9f11ffb7Safresh1$VERSION = '3.28';
7898184e3Ssthen
8898184e3Ssthenuse parent qw(Pod::Perldoc::BaseTo);
9898184e3Ssthen
10898184e3Ssthensub is_pageable        { 1 }
11898184e3Ssthensub write_with_binmode { 0 }
12898184e3Ssthensub output_extension   { 'txt' }
13898184e3Ssthen
14898184e3Ssthenuse Pod::Text ();
15898184e3Ssthen
16898184e3Ssthensub alt       { shift->_perldoc_elem('alt'     , @_) }
17898184e3Ssthensub indent    { shift->_perldoc_elem('indent'  , @_) }
18898184e3Ssthensub loose     { shift->_perldoc_elem('loose'   , @_) }
19898184e3Ssthensub quotes    { shift->_perldoc_elem('quotes'  , @_) }
20898184e3Ssthensub sentence  { shift->_perldoc_elem('sentence', @_) }
21898184e3Ssthensub width     { shift->_perldoc_elem('width'   , @_) }
22898184e3Ssthen
23898184e3Ssthensub new { return bless {}, ref($_[0]) || $_[0] }
24898184e3Ssthen
25898184e3Ssthensub parse_from_file {
26898184e3Ssthen  my $self = shift;
27898184e3Ssthen
28898184e3Ssthen  my @options =
29898184e3Ssthen    map {; $_, $self->{$_} }
30898184e3Ssthen      grep !m/^_/s,
31898184e3Ssthen        keys %$self
32898184e3Ssthen  ;
33898184e3Ssthen
34898184e3Ssthen  defined(&Pod::Perldoc::DEBUG)
35898184e3Ssthen   and Pod::Perldoc::DEBUG()
36898184e3Ssthen   and print "About to call new Pod::Text ",
37898184e3Ssthen    $Pod::Text::VERSION ? "(v$Pod::Text::VERSION) " : '',
38898184e3Ssthen    "with options: ",
39898184e3Ssthen    @options ? "[@options]" : "(nil)", "\n";
40898184e3Ssthen  ;
41898184e3Ssthen
42898184e3Ssthen  Pod::Text->new(@options)->parse_from_file(@_);
43898184e3Ssthen}
44898184e3Ssthen
45898184e3Ssthen1;
46898184e3Ssthen
47898184e3Ssthen=head1 NAME
48898184e3Ssthen
49898184e3SsthenPod::Perldoc::ToText - let Perldoc render Pod as plaintext
50898184e3Ssthen
51898184e3Ssthen=head1 SYNOPSIS
52898184e3Ssthen
53898184e3Ssthen  perldoc -o text Some::Modulename
54898184e3Ssthen
55898184e3Ssthen=head1 DESCRIPTION
56898184e3Ssthen
57898184e3SsthenThis is a "plug-in" class that allows Perldoc to use
58898184e3SsthenPod::Text as a formatter class.
59898184e3Ssthen
60898184e3SsthenIt supports the following options, which are explained in
61898184e3SsthenL<Pod::Text>: alt, indent, loose, quotes, sentence, width
62898184e3Ssthen
63898184e3SsthenFor example:
64898184e3Ssthen
65898184e3Ssthen  perldoc -o text -w indent:5 Some::Modulename
66898184e3Ssthen
67898184e3Ssthen=head1 CAVEAT
68898184e3Ssthen
69898184e3SsthenThis module may change to use a different text formatter class in the
70898184e3Ssthenfuture, and this may change what options are supported.
71898184e3Ssthen
72898184e3Ssthen=head1 SEE ALSO
73898184e3Ssthen
74898184e3SsthenL<Pod::Text>, L<Pod::Perldoc>
75898184e3Ssthen
76898184e3Ssthen=head1 COPYRIGHT AND DISCLAIMERS
77898184e3Ssthen
78898184e3SsthenCopyright (c) 2002 Sean M. Burke.  All rights reserved.
79898184e3Ssthen
80898184e3SsthenThis library is free software; you can redistribute it and/or modify it
81898184e3Ssthenunder the same terms as Perl itself.
82898184e3Ssthen
83898184e3SsthenThis program is distributed in the hope that it will be useful, but
84898184e3Ssthenwithout any warranty; without even the implied warranty of
85898184e3Ssthenmerchantability or fitness for a particular purpose.
86898184e3Ssthen
87898184e3Ssthen=head1 AUTHOR
88898184e3Ssthen
89898184e3SsthenCurrent maintainer: Mark Allen C<< <mallen@cpan.org> >>
90898184e3Ssthen
91898184e3SsthenPast contributions from:
92898184e3Ssthenbrian d foy C<< <bdfoy@cpan.org> >>
93898184e3SsthenAdriano R. Ferreira C<< <ferreira@cpan.org> >>,
94898184e3SsthenSean M. Burke C<< <sburke@cpan.org> >>
95898184e3Ssthen
96898184e3Ssthen
97898184e3Ssthen=cut
98898184e3Ssthen
99