line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package DocLife::Pod; |
2
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
40253
|
use strict; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
34
|
|
4
|
1
|
|
|
1
|
|
5
|
use warnings; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
31
|
|
5
|
1
|
|
|
1
|
|
797
|
use parent 'DocLife'; |
|
1
|
|
|
|
|
294
|
|
|
1
|
|
|
|
|
6
|
|
6
|
1
|
|
|
1
|
|
2867
|
use Pod::Simple::XHTML; |
|
1
|
|
|
|
|
67047
|
|
|
1
|
|
|
|
|
261
|
|
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
sub format { |
9
|
3
|
|
|
3
|
0
|
9
|
my ($self, $req, $res, $file) = @_; |
10
|
|
|
|
|
|
|
|
11
|
3
|
|
|
|
|
14
|
my $body = $file->slurp; |
12
|
3
|
50
|
|
|
|
944
|
if ($req->param('source')) { |
13
|
0
|
|
|
|
|
0
|
$res->content_type('text/plain'); |
14
|
0
|
|
|
|
|
0
|
$res->body($body); |
15
|
0
|
|
|
|
|
0
|
return; |
16
|
|
|
|
|
|
|
} |
17
|
|
|
|
|
|
|
|
18
|
3
|
|
|
|
|
654
|
my $home = $self->base_url; |
19
|
3
|
|
|
|
|
37
|
my ($title) = $body=~m|^package (.*);|; |
20
|
3
|
|
33
|
|
|
11
|
$title ||= $file->basename; |
21
|
3
|
|
|
|
|
10
|
my $src = qq{ Home Source}; |
22
|
3
|
|
|
|
|
37
|
my $pod = Pod::Simple::XHTML->new; |
23
|
3
|
|
|
|
|
530
|
$pod->html_header($self->html_header($title) . $src); |
24
|
3
|
|
|
|
|
29
|
$pod->index(1); |
25
|
3
|
|
|
|
|
39
|
$pod->output_string(\my $html); |
26
|
3
|
|
|
|
|
2291
|
$pod->parse_string_document($body); |
27
|
3
|
|
|
|
|
35242
|
$res->body($html); |
28
|
|
|
|
|
|
|
} |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
sub html_header { |
31
|
3
|
|
|
3
|
0
|
7
|
my ($self, $title) = @_; |
32
|
3
|
50
|
|
|
|
12
|
$title = 'Index' unless defined $title; |
33
|
|
|
|
|
|
|
<<"EOF" |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
$title |
38
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
EOF |
85
|
3
|
|
|
|
|
28
|
} |
86
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
=head1 NAME |
88
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
DocLife::Pod - Pod Viewer. |
90
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
=head1 SYNOPSIS |
92
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
# app.psgi |
94
|
|
|
|
|
|
|
use DocLife::Pod; |
95
|
|
|
|
|
|
|
DocLife::Pod->new( root => "./lib" ); |
96
|
|
|
|
|
|
|
|
97
|
|
|
|
|
|
|
# one-liner |
98
|
|
|
|
|
|
|
plackup -MDocLife::Pod -e 'DocLife::Pod->new( root => "./lib" )->to_app' |
99
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
=head1 SEE ALSO |
101
|
|
|
|
|
|
|
|
102
|
|
|
|
|
|
|
L, L |
103
|
|
|
|
|
|
|
|
104
|
|
|
|
|
|
|
=cut |
105
|
|
|
|
|
|
|
|
106
|
|
|
|
|
|
|
1; |