line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
require 5; |
2
|
1
|
|
|
1
|
|
1542
|
use 5.006; |
|
1
|
|
|
|
|
5
|
|
|
1
|
|
|
|
|
51
|
|
3
|
|
|
|
|
|
|
package AnnoCPAN::Perldoc; |
4
|
1
|
|
|
1
|
|
6
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
45
|
|
5
|
1
|
|
|
1
|
|
5
|
use warnings; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
45
|
|
6
|
1
|
|
|
1
|
|
5
|
use base 'Pod::Perldoc'; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
1263
|
|
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
our $VERSION = '0.10'; |
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
sub maybe_generate_dynamic_pod { |
11
|
0
|
|
|
0
|
0
|
|
my($self, $found_things) = @_; |
12
|
|
|
|
|
|
|
|
13
|
0
|
0
|
0
|
|
|
|
if ($self->opt_f or $self->opt_q) { |
14
|
0
|
|
|
|
|
|
warn "Warning: -f and -q do not support annotations yet\n"; |
15
|
0
|
|
|
|
|
|
return shift->SUPER::maybe_generate_dynamic_pod(@_); |
16
|
|
|
|
|
|
|
} |
17
|
|
|
|
|
|
|
|
18
|
0
|
|
|
|
|
|
my @dynamic_pod; |
19
|
|
|
|
|
|
|
|
20
|
0
|
|
|
|
|
|
$self->filter_pod($found_things, \@dynamic_pod); |
21
|
|
|
|
|
|
|
|
22
|
0
|
|
|
|
|
|
my ($buffd, $buffer) = $self->new_tempfile('pod', 'dyn'); |
23
|
|
|
|
|
|
|
|
24
|
0
|
|
|
|
|
|
push @{ $self->{'temp_file_list'} }, $buffer; |
|
0
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
|
27
|
0
|
0
|
|
|
|
|
print $buffd @dynamic_pod or die "Can't print $buffer: $!"; |
28
|
0
|
0
|
|
|
|
|
close $buffd or die "Can't close $buffer: $!"; |
29
|
|
|
|
|
|
|
|
30
|
0
|
|
|
|
|
|
@$found_things = $buffer; |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
|
34
|
0
|
|
|
|
|
|
$self->add_formatter_option('__filter_nroff' => 1); |
35
|
|
|
|
|
|
|
|
36
|
0
|
|
|
|
|
|
return; |
37
|
|
|
|
|
|
|
} |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
sub filter_pod { |
41
|
0
|
|
|
0
|
0
|
|
my($self, $found_things, $pod) = @_; |
42
|
|
|
|
|
|
|
|
43
|
0
|
|
|
|
|
|
Pod::Perldoc::DEBUG > 2 and print "Search: @$found_things\n"; |
44
|
|
|
|
|
|
|
|
45
|
0
|
|
|
|
|
|
my $file = shift @$found_things; |
46
|
0
|
0
|
|
|
|
|
open(F, "<", $file) |
47
|
|
|
|
|
|
|
or die("Can't open $file $!"); |
48
|
|
|
|
|
|
|
|
49
|
0
|
|
|
|
|
|
Pod::Perldoc::DEBUG > 2 and |
50
|
|
|
|
|
|
|
print "Going to filter for $file\n"; |
51
|
|
|
|
|
|
|
|
52
|
0
|
|
|
|
|
|
my $content = do { local $/; <F> }; |
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
|
54
|
0
|
|
|
|
|
|
my ($filter_class) = 'AnnoCPAN::Perldoc::Filter'; |
55
|
|
|
|
|
|
|
|
56
|
0
|
|
|
|
|
|
eval "require $filter_class"; |
57
|
0
|
0
|
|
|
|
|
if($@) { |
58
|
0
|
|
|
|
|
|
die "Couldn't load filter class '$filter_class': $@\n"; |
59
|
|
|
|
|
|
|
} |
60
|
|
|
|
|
|
|
|
61
|
0
|
0
|
|
|
|
|
my $filter = $filter_class->can('new') |
62
|
|
|
|
|
|
|
? $filter_class->new |
63
|
|
|
|
|
|
|
: $filter_class |
64
|
|
|
|
|
|
|
; |
65
|
|
|
|
|
|
|
|
66
|
0
|
|
|
|
|
|
@$pod = $filter->filter($content); |
67
|
|
|
|
|
|
|
|
68
|
0
|
0
|
|
|
|
|
close F or die "Can't close $file $!"; |
69
|
0
|
|
|
|
|
|
return; |
70
|
|
|
|
|
|
|
} |
71
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
1; |
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
__END__ |
75
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
=head1 NAME |
77
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
AnnoCPAN::Perldoc - Integrate AnnoCPAN notes locally into perldoc |
79
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
=head1 SYNOPSYS |
81
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
# This is a fully functional 'perldoc' |
83
|
|
|
|
|
|
|
use AnnoCPAN::Perldoc; |
84
|
|
|
|
|
|
|
AnnoCPAN::Perldoc->run; |
85
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
=head1 DESCRIPTION |
87
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
AnnoCPAN is a web interface for the documentation of all the modules on CPAN, |
89
|
|
|
|
|
|
|
where users can add annotations on the margin of specific paragraphs throughout |
90
|
|
|
|
|
|
|
the POD. The master AnnoCPAN site is located at http://annocpan.org/. |
91
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
AnnoCPAN-Perldoc provides a substitute for the 'perldoc' command that displays |
93
|
|
|
|
|
|
|
the annotations locally and without requiring a connection to the Internet. |
94
|
|
|
|
|
|
|
It works by using a local note database that can be downloaded from |
95
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
http://annocpan.org/annopod.db |
97
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
This is an SQLite3 database; the file should be saved in one of these |
99
|
|
|
|
|
|
|
locations: |
100
|
|
|
|
|
|
|
|
101
|
|
|
|
|
|
|
$HOME |
102
|
|
|
|
|
|
|
$USERPROFILE |
103
|
|
|
|
|
|
|
$ALLUSERSPROFILE |
104
|
|
|
|
|
|
|
/var/annocpan |
105
|
|
|
|
|
|
|
|
106
|
|
|
|
|
|
|
It can also be called .annopod.db, to hide it in Unix-like systems. It is your |
107
|
|
|
|
|
|
|
resposibility to keep this file as up-to-date as you want. Future versions may |
108
|
|
|
|
|
|
|
include an automatic update feature (which will require network connectivity). |
109
|
|
|
|
|
|
|
|
110
|
|
|
|
|
|
|
=head1 SEE ALSO |
111
|
|
|
|
|
|
|
|
112
|
|
|
|
|
|
|
L<annopod>, |
113
|
|
|
|
|
|
|
L<AnnoCPAN>, |
114
|
|
|
|
|
|
|
L<Pod::Perldoc> |
115
|
|
|
|
|
|
|
|
116
|
|
|
|
|
|
|
=head1 AUTHOR |
117
|
|
|
|
|
|
|
|
118
|
|
|
|
|
|
|
Ivan Tubert-Brohman E<lt>itub@cpan.orgE<gt> |
119
|
|
|
|
|
|
|
|
120
|
|
|
|
|
|
|
=head1 COPYRIGHT |
121
|
|
|
|
|
|
|
|
122
|
|
|
|
|
|
|
Copyright (c) 2005 Ivan Tubert-Brohman. All rights reserved. This program is |
123
|
|
|
|
|
|
|
free software; you can redistribute it and/or modify it under the same terms as |
124
|
|
|
|
|
|
|
Perl itself. |
125
|
|
|
|
|
|
|
|
126
|
|
|
|
|
|
|
=cut |
127
|
|
|
|
|
|
|
|
128
|
|
|
|
|
|
|
|