This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Update Pod-Perldoc to CPAN version 3.21
[perl5.git] / cpan / Pod-Perldoc / lib / Pod / Perldoc / ToText.pm
CommitLineData
1a67fee7
HS
1package Pod::Perldoc::ToText;
2use strict;
3use warnings;
4
0909e3f8 5use vars qw($VERSION);
37279817 6$VERSION = '3.21';
0909e3f8
RS
7
8use parent qw(Pod::Perldoc::BaseTo);
1a67fee7
HS
9
10sub is_pageable { 1 }
11sub write_with_binmode { 0 }
12sub output_extension { 'txt' }
13
14use Pod::Text ();
15
16sub alt { shift->_perldoc_elem('alt' , @_) }
17sub indent { shift->_perldoc_elem('indent' , @_) }
18sub loose { shift->_perldoc_elem('loose' , @_) }
19sub quotes { shift->_perldoc_elem('quotes' , @_) }
20sub sentence { shift->_perldoc_elem('sentence', @_) }
21sub width { shift->_perldoc_elem('width' , @_) }
22
23sub new { return bless {}, ref($_[0]) || $_[0] }
24
25sub 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
451;
46
47=head1 NAME
48
49Pod::Perldoc::ToText - let Perldoc render Pod as plaintext
50
51=head1 SYNOPSIS
52
53 perldoc -o text Some::Modulename
54
55=head1 DESCRIPTION
56
57This is a "plug-in" class that allows Perldoc to use
58Pod::Text as a formatter class.
59
60It supports the following options, which are explained in
61L<Pod::Text>: alt, indent, loose, quotes, sentence, width
62
63For example:
64
65 perldoc -o text -w indent:5 Some::Modulename
66
67=head1 CAVEAT
68
69This module may change to use a different text formatter class in the
70future, and this may change what options are supported.
71
72=head1 SEE ALSO
73
74L<Pod::Text>, L<Pod::Perldoc>
75
76=head1 COPYRIGHT AND DISCLAIMERS
77
78Copyright (c) 2002 Sean M. Burke. All rights reserved.
79
80This library is free software; you can redistribute it and/or modify it
81under the same terms as Perl itself.
82
83This program is distributed in the hope that it will be useful, but
84without any warranty; without even the implied warranty of
85merchantability or fitness for a particular purpose.
86
87=head1 AUTHOR
88
0909e3f8 89Current maintainer: Mark Allen C<< <mallen@cpan.org> >>
91a46224
AF
90
91Past contributions from:
0909e3f8
RS
92brian d foy C<< <bdfoy@cpan.org> >>
93Adriano R. Ferreira C<< <ferreira@cpan.org> >>,
94Sean M. Burke C<< <sburke@cpan.org> >>
91a46224 95
1a67fee7
HS
96
97=cut
a6b91202 98