line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Pod::Strip; |
2
|
|
|
|
|
|
|
|
3
|
4
|
|
|
4
|
|
224993
|
use warnings; |
|
4
|
|
|
|
|
11
|
|
|
4
|
|
|
|
|
151
|
|
4
|
4
|
|
|
4
|
|
22
|
use strict; |
|
4
|
|
|
|
|
8
|
|
|
4
|
|
|
|
|
161
|
|
5
|
|
|
|
|
|
|
|
6
|
4
|
|
|
4
|
|
21
|
use base ('Pod::Simple'); |
|
4
|
|
|
|
|
13
|
|
|
4
|
|
|
|
|
5204
|
|
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
our $VERSION = "1.02"; |
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
sub new { |
11
|
3
|
|
|
3
|
1
|
696
|
my $new = shift->SUPER::new(@_); |
12
|
3
|
|
|
|
|
109
|
$new->{_code_line}=0; |
13
|
|
|
|
|
|
|
$new->code_handler( |
14
|
|
|
|
|
|
|
sub { |
15
|
|
|
|
|
|
|
|
16
|
53
|
100
|
|
53
|
|
11630
|
if ($_[2]->{_replace_with_comments}) { |
17
|
10
|
100
|
|
|
|
33
|
if ($_[2]->{_code_line}+1<$_[1]) { |
18
|
2
|
|
|
|
|
4
|
print {$_[2]{output_fh}} ("# stripped POD\n") x ($_[1] - $_[2]->{_code_line} -1 ); |
|
2
|
|
|
|
|
14
|
|
19
|
|
|
|
|
|
|
} |
20
|
10
|
|
|
|
|
48
|
$_[2]->{_code_line}=$_[1]; |
21
|
|
|
|
|
|
|
} |
22
|
53
|
|
|
|
|
63
|
print {$_[2]{output_fh}} $_[0],"\n"; |
|
53
|
|
|
|
|
186
|
|
23
|
53
|
|
|
|
|
483
|
return; |
24
|
3
|
|
|
|
|
34
|
}); |
25
|
3
|
|
|
|
|
30
|
return $new; |
26
|
|
|
|
|
|
|
} |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
sub replace_with_comments { |
30
|
2
|
|
|
2
|
1
|
10
|
my $self = shift; |
31
|
2
|
100
|
|
|
|
15
|
$self->{_replace_with_comments} = defined $_[0] ? $_[0] : 1; |
32
|
|
|
|
|
|
|
} |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
1; |
36
|
|
|
|
|
|
|
__END__ |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
=pod |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
=head1 NAME |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
Pod::Strip - Remove POD from Perl code |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
=head1 SYNOPSIS |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
use Pod::Strip; |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
my $p=Pod::Strip->new; # create parser |
49
|
|
|
|
|
|
|
my $podless; # set output string |
50
|
|
|
|
|
|
|
$p->output_string(\$podless); # see Pod::Simple |
51
|
|
|
|
|
|
|
$p->parse_string_document($code); # or some other parsing method |
52
|
|
|
|
|
|
|
# from Pod::Simple |
53
|
|
|
|
|
|
|
# $podless will now contain code without any POD |
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
=head1 DESCRIPTION |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
Pod::Strip is a subclass of Pod::Simple that strips all POD from Perl Code. |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
=head1 METHODS |
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
All methods besides those listed here are inherited from Pod::Simple |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
=head2 new |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
Generate a new parser object. |
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
=head2 replace_with_comments |
69
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
Call this method with a true argument to replace POD with comments (looking like "# stripped POD") instead of stripping it. |
71
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
This has the effect that line numbers get reported correctly in error |
73
|
|
|
|
|
|
|
messages etc. |
74
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
=head1 AUTHOR |
76
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
Thomas Klausner, C<< <domm@cpan.org> >> |
78
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
=head1 BUGS |
80
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
Please report any bugs or feature requests to |
82
|
|
|
|
|
|
|
C<bug-pod-strip@rt.cpan.org>, or through the web interface at |
83
|
|
|
|
|
|
|
L<http://rt.cpan.org>. I will be notified, and then you'll automatically |
84
|
|
|
|
|
|
|
be notified of progress on your bug as I make changes. |
85
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
=head1 COPYRIGHT & LICENSE |
87
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
Copyright 2004, 2005, 2006 Thomas Klausner, All Rights Reserved. |
89
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
This program is free software; you can redistribute it and/or modify it |
91
|
|
|
|
|
|
|
under the same terms as Perl itself. |
92
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
=cut |
94
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
|