| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package Pod::Perldoc::ToTerm; |
|
2
|
1
|
|
|
1
|
|
696
|
use strict; |
|
|
1
|
|
|
|
|
1
|
|
|
|
1
|
|
|
|
|
23
|
|
|
3
|
1
|
|
|
1
|
|
3
|
use warnings; |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
20
|
|
|
4
|
|
|
|
|
|
|
|
|
5
|
1
|
|
|
1
|
|
3
|
use vars qw($VERSION); |
|
|
1
|
|
|
|
|
1
|
|
|
|
1
|
|
|
|
|
36
|
|
|
6
|
|
|
|
|
|
|
$VERSION = '3.27'; |
|
7
|
|
|
|
|
|
|
|
|
8
|
1
|
|
|
1
|
|
3
|
use parent qw(Pod::Perldoc::BaseTo); |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
3
|
|
|
9
|
|
|
|
|
|
|
|
|
10
|
0
|
|
|
0
|
0
|
|
sub is_pageable { 1 } |
|
11
|
0
|
|
|
0
|
0
|
|
sub write_with_binmode { 0 } |
|
12
|
0
|
|
|
0
|
0
|
|
sub output_extension { 'txt' } |
|
13
|
|
|
|
|
|
|
|
|
14
|
1
|
|
|
1
|
|
486
|
use Pod::Text::Termcap (); |
|
|
1
|
|
|
|
|
7074
|
|
|
|
1
|
|
|
|
|
399
|
|
|
15
|
|
|
|
|
|
|
|
|
16
|
0
|
|
|
0
|
0
|
|
sub alt { shift->_perldoc_elem('alt' , @_) } |
|
17
|
0
|
|
|
0
|
0
|
|
sub indent { shift->_perldoc_elem('indent' , @_) } |
|
18
|
0
|
|
|
0
|
0
|
|
sub loose { shift->_perldoc_elem('loose' , @_) } |
|
19
|
0
|
|
|
0
|
0
|
|
sub quotes { shift->_perldoc_elem('quotes' , @_) } |
|
20
|
0
|
|
|
0
|
0
|
|
sub sentence { shift->_perldoc_elem('sentence', @_) } |
|
21
|
|
|
|
|
|
|
sub width { |
|
22
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
|
23
|
0
|
0
|
0
|
|
|
|
$self->_perldoc_elem('width' , @_) || |
|
|
|
|
0
|
|
|
|
|
|
24
|
|
|
|
|
|
|
$self->_get_columns_from_manwidth || |
|
25
|
|
|
|
|
|
|
$self->_get_columns_from_stty || |
|
26
|
|
|
|
|
|
|
$self->_get_default_width; |
|
27
|
|
|
|
|
|
|
} |
|
28
|
|
|
|
|
|
|
|
|
29
|
0
|
|
|
0
|
|
|
sub _get_stty { `stty -a` } |
|
30
|
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
sub _get_columns_from_stty { |
|
32
|
0
|
|
|
0
|
|
|
my $output = $_[0]->_get_stty; |
|
33
|
|
|
|
|
|
|
|
|
34
|
0
|
0
|
|
|
|
|
if( $output =~ /\bcolumns\s+(\d+)/ ) { return $1; } |
|
|
0
|
0
|
|
|
|
|
|
|
35
|
0
|
|
|
|
|
|
elsif( $output =~ /;\s*(\d+)\s+columns;/ ) { return $1; } |
|
36
|
0
|
|
|
|
|
|
else { return 0 } |
|
37
|
|
|
|
|
|
|
} |
|
38
|
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
sub _get_columns_from_manwidth { |
|
40
|
0
|
|
|
0
|
|
|
my( $self ) = @_; |
|
41
|
|
|
|
|
|
|
|
|
42
|
0
|
0
|
|
|
|
|
return 0 unless defined $ENV{MANWIDTH}; |
|
43
|
|
|
|
|
|
|
|
|
44
|
0
|
0
|
|
|
|
|
unless( $ENV{MANWIDTH} =~ m/\A\d+\z/ ) { |
|
45
|
0
|
|
|
|
|
|
$self->warn( "Ignoring non-numeric MANWIDTH ($ENV{MANWIDTH})\n" ); |
|
46
|
0
|
|
|
|
|
|
return 0; |
|
47
|
|
|
|
|
|
|
} |
|
48
|
|
|
|
|
|
|
|
|
49
|
0
|
0
|
|
|
|
|
if( $ENV{MANWIDTH} == 0 ) { |
|
50
|
0
|
|
|
|
|
|
$self->warn( "Ignoring MANWIDTH of 0. Really? Why even run the program? :)\n" ); |
|
51
|
0
|
|
|
|
|
|
return 0; |
|
52
|
|
|
|
|
|
|
} |
|
53
|
|
|
|
|
|
|
|
|
54
|
0
|
0
|
|
|
|
|
if( $ENV{MANWIDTH} =~ m/\A(\d+)\z/ ) { return $1 } |
|
|
0
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
|
|
56
|
0
|
|
|
|
|
|
return 0; |
|
57
|
|
|
|
|
|
|
} |
|
58
|
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
sub _get_default_width { |
|
60
|
0
|
|
|
0
|
|
|
76 |
|
61
|
|
|
|
|
|
|
} |
|
62
|
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
|
|
64
|
0
|
|
0
|
0
|
0
|
|
sub new { return bless {}, ref($_[0]) || $_[0] } |
|
65
|
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
sub parse_from_file { |
|
67
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
|
68
|
|
|
|
|
|
|
|
|
69
|
0
|
|
|
|
|
|
$self->{width} = $self->width(); |
|
70
|
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
my @options = |
|
72
|
0
|
|
|
|
|
|
map {; $_, $self->{$_} } |
|
|
0
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
grep !m/^_/s, |
|
74
|
|
|
|
|
|
|
keys %$self |
|
75
|
|
|
|
|
|
|
; |
|
76
|
|
|
|
|
|
|
|
|
77
|
0
|
0
|
0
|
|
|
|
defined(&Pod::Perldoc::DEBUG) |
|
|
|
0
|
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
and Pod::Perldoc::DEBUG() |
|
79
|
|
|
|
|
|
|
and print "About to call new Pod::Text::Termcap ", |
|
80
|
|
|
|
|
|
|
$Pod::Text::VERSION ? "(v$Pod::Text::Termcap::VERSION) " : '', |
|
81
|
|
|
|
|
|
|
"with options: ", |
|
82
|
|
|
|
|
|
|
@options ? "[@options]" : "(nil)", "\n"; |
|
83
|
|
|
|
|
|
|
; |
|
84
|
|
|
|
|
|
|
|
|
85
|
0
|
|
|
|
|
|
Pod::Text::Termcap->new(@options)->parse_from_file(@_); |
|
86
|
|
|
|
|
|
|
} |
|
87
|
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
1; |
|
89
|
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
=head1 NAME |
|
91
|
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
Pod::Perldoc::ToTerm - render Pod with terminal escapes |
|
93
|
|
|
|
|
|
|
|
|
94
|
|
|
|
|
|
|
=head1 SYNOPSIS |
|
95
|
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
perldoc -o term Some::Modulename |
|
97
|
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
=head1 DESCRIPTION |
|
99
|
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
This is a "plug-in" class that allows Perldoc to use |
|
101
|
|
|
|
|
|
|
Pod::Text as a formatter class. |
|
102
|
|
|
|
|
|
|
|
|
103
|
|
|
|
|
|
|
It supports the following options, which are explained in |
|
104
|
|
|
|
|
|
|
L: alt, indent, loose, quotes, sentence, width |
|
105
|
|
|
|
|
|
|
|
|
106
|
|
|
|
|
|
|
For example: |
|
107
|
|
|
|
|
|
|
|
|
108
|
|
|
|
|
|
|
perldoc -o term -w indent:5 Some::Modulename |
|
109
|
|
|
|
|
|
|
|
|
110
|
|
|
|
|
|
|
=head1 CAVEAT |
|
111
|
|
|
|
|
|
|
|
|
112
|
|
|
|
|
|
|
This module may change to use a different text formatter class in the |
|
113
|
|
|
|
|
|
|
future, and this may change what options are supported. |
|
114
|
|
|
|
|
|
|
|
|
115
|
|
|
|
|
|
|
=head1 SEE ALSO |
|
116
|
|
|
|
|
|
|
|
|
117
|
|
|
|
|
|
|
L, L, L |
|
118
|
|
|
|
|
|
|
|
|
119
|
|
|
|
|
|
|
=head1 COPYRIGHT AND DISCLAIMERS |
|
120
|
|
|
|
|
|
|
|
|
121
|
|
|
|
|
|
|
Copyright (c) 2011 Mark Allen. |
|
122
|
|
|
|
|
|
|
|
|
123
|
|
|
|
|
|
|
This program is free software; you can redistribute it and/or modify it |
|
124
|
|
|
|
|
|
|
under the terms of either: the GNU General Public License as published |
|
125
|
|
|
|
|
|
|
by the Free Software Foundation; or the Artistic License. |
|
126
|
|
|
|
|
|
|
|
|
127
|
|
|
|
|
|
|
See http://dev.perl.org/licenses/ for more information. |
|
128
|
|
|
|
|
|
|
|
|
129
|
|
|
|
|
|
|
=head1 AUTHOR |
|
130
|
|
|
|
|
|
|
|
|
131
|
|
|
|
|
|
|
Mark Allen C<< >> |
|
132
|
|
|
|
|
|
|
|
|
133
|
|
|
|
|
|
|
=cut |