1package Pod::Perldoc::ToTerm; 2use strict; 3use warnings; 4 5use vars qw($VERSION); 6$VERSION = '3.17'; 7 8use parent qw(Pod::Perldoc::BaseTo); 9 10sub is_pageable { 1 } 11sub write_with_binmode { 0 } 12sub output_extension { 'txt' } 13 14use Pod::Text::Termcap (); 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; 27 28 my @options = 29 map {; $_, $self->{$_} } 30 grep !m/^_/s, 31 keys %$self 32 ; 33 34 defined(&Pod::Perldoc::DEBUG) 35 and Pod::Perldoc::DEBUG() 36 and print "About to call new Pod::Text::Termcap ", 37 $Pod::Text::VERSION ? "(v$Pod::Text::VERSION) " : '', 38 "with options: ", 39 @options ? "[@options]" : "(nil)", "\n"; 40 ; 41 42 Pod::Text::Termcap->new(@options)->parse_from_file(@_); 43} 44 451; 46 47=head1 NAME 48 49Pod::Perldoc::ToTerm - render Pod with terminal escapes 50 51=head1 SYNOPSIS 52 53 perldoc -o term 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 term -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::Text::Termcap>, L<Pod::Perldoc> 75 76=head1 COPYRIGHT AND DISCLAIMERS 77 78Copyright (c) 2011 Mark Allen. 79 80This program is free software; you can redistribute it and/or modify it 81under the terms of either: the GNU General Public License as published 82by the Free Software Foundation; or the Artistic License. 83 84See http://dev.perl.org/licenses/ for more information. 85 86=head1 AUTHOR 87 88Mark Allen C<< <mallen@cpan.org> >> 89 90=cut 91