line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package App::Grok::Parser::Pod6; |
2
|
|
|
|
|
|
|
BEGIN { |
3
|
2
|
|
|
2
|
|
40328
|
$App::Grok::Parser::Pod6::AUTHORITY = 'cpan:HINRIK'; |
4
|
|
|
|
|
|
|
} |
5
|
|
|
|
|
|
|
{ |
6
|
|
|
|
|
|
|
$App::Grok::Parser::Pod6::VERSION = '0.26'; |
7
|
|
|
|
|
|
|
} |
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
# blows up if we use strict before this, damn source filter |
10
|
2
|
|
|
2
|
|
4580
|
use Perl6::Perldoc::Parser; |
|
2
|
|
|
|
|
178379
|
|
|
2
|
|
|
|
|
104
|
|
11
|
|
|
|
|
|
|
|
12
|
2
|
|
|
2
|
|
30
|
use strict; |
|
2
|
|
|
|
|
6
|
|
|
2
|
|
|
|
|
93
|
|
13
|
2
|
|
|
2
|
|
15
|
use warnings FATAL => 'all'; |
|
2
|
|
|
|
|
5
|
|
|
2
|
|
|
|
|
837
|
|
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
sub new { |
16
|
1
|
|
|
1
|
1
|
24
|
my ($package, %self) = @_; |
17
|
1
|
|
|
|
|
10
|
return bless \%self, $package; |
18
|
|
|
|
|
|
|
} |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
sub render_file { |
21
|
2
|
|
|
2
|
1
|
6273
|
my ($self, $file, $format) = @_; |
22
|
|
|
|
|
|
|
|
23
|
2
|
50
|
|
|
|
19
|
if ($format !~ /^(?:ansi|text|xhtml)$/) { |
24
|
0
|
|
|
|
|
0
|
die __PACKAGE__ . " doesn't support the '$format' format"; |
25
|
|
|
|
|
|
|
} |
26
|
2
|
|
|
|
|
199
|
eval "require Perl6::Perldoc::To::\u$format"; |
27
|
2
|
50
|
|
|
|
130246
|
die $@ if $@; |
28
|
|
|
|
|
|
|
|
29
|
2
|
|
|
|
|
8
|
my $method = "to_$format"; |
30
|
2
|
|
|
|
|
25
|
return Perl6::Perldoc::Parser->parse($file, {all_pod=>'auto'}) |
31
|
|
|
|
|
|
|
->report_errors() |
32
|
|
|
|
|
|
|
->$method(); |
33
|
|
|
|
|
|
|
} |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
sub render_string { |
36
|
0
|
|
|
0
|
1
|
|
my ($self, $string, $format) = @_; |
37
|
|
|
|
|
|
|
|
38
|
0
|
0
|
|
|
|
|
open my $handle, '<', \$string or die "Can't open input filehandle: $!"; |
39
|
0
|
|
|
|
|
|
binmode $handle, ':utf8'; |
40
|
0
|
|
|
|
|
|
my $result = $self->render_file($handle, $format); |
41
|
0
|
|
|
|
|
|
close $handle; |
42
|
0
|
|
|
|
|
|
return $result; |
43
|
|
|
|
|
|
|
} |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
1; |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
=encoding utf8 |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
=head1 NAME |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
App::Grok::Parser::Pod6 - A Pod 6 backend for grok |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
=head1 METHODS |
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
=head2 C<new> |
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
This is the constructor. It currently takes no arguments. |
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
=head2 C<render_file> |
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
Takes two arguments, a filename and the name of an output format. Returns |
62
|
|
|
|
|
|
|
a string containing the rendered document. It will C<die> if there is an |
63
|
|
|
|
|
|
|
error. |
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
=head2 C<render_string> |
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
Takes two arguments, a string and the name of an output format. Returns |
68
|
|
|
|
|
|
|
a string containing the rendered document. It will C<die> if there is an |
69
|
|
|
|
|
|
|
error. |
70
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
=head1 AUTHOR |
72
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
Hinrik Ãrn Sigurðsson, L<hinrik.sig@gmail.com> |
74
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
=head1 LICENSE AND COPYRIGHT |
76
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
Copyright 2009 Hinrik Ãrn Sigurðsson |
78
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
C<grok> is distributed under the terms of the Artistic License 2.0. |
80
|
|
|
|
|
|
|
For more details, see the full text of the license in the file F<LICENSE> |
81
|
|
|
|
|
|
|
that came with this distribution. |
82
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
=cut |