line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Pod::Abstract::Filter::sort; |
2
|
1
|
|
|
1
|
|
1035
|
use strict; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
29
|
|
3
|
1
|
|
|
1
|
|
5
|
use warnings; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
22
|
|
4
|
|
|
|
|
|
|
|
5
|
1
|
|
|
1
|
|
5
|
use Data::Dumper; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
48
|
|
6
|
|
|
|
|
|
|
|
7
|
1
|
|
|
1
|
|
6
|
use base qw(Pod::Abstract::Filter); |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
318
|
|
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
=head1 NAME |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
Pod::Abstract::Filter::sort - paf command to alphabetically sort |
12
|
|
|
|
|
|
|
sub-sections within a Pod section |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
=cut |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
our $VERSION = '0.20'; |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
sub filter { |
19
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
20
|
0
|
|
|
|
|
|
my $pa = shift; |
21
|
|
|
|
|
|
|
|
22
|
0
|
|
|
|
|
|
my $heading = $self->param('heading'); |
23
|
0
|
0
|
|
|
|
|
$heading = 'METHODS' unless defined $heading; |
24
|
|
|
|
|
|
|
|
25
|
0
|
|
|
|
|
|
my @targets = $pa->select("//[\@heading =~ {$heading}]"); |
26
|
0
|
|
|
|
|
|
my @spec_targets = $pa->select("//[/for =~ {^sorting}]"); |
27
|
|
|
|
|
|
|
|
28
|
0
|
0
|
|
|
|
|
if($self->param('heading')) { |
29
|
0
|
|
|
|
|
|
push @targets, @spec_targets; |
30
|
|
|
|
|
|
|
} else { |
31
|
0
|
0
|
|
|
|
|
@targets = @spec_targets if @spec_targets; |
32
|
|
|
|
|
|
|
} |
33
|
|
|
|
|
|
|
|
34
|
0
|
|
|
|
|
|
foreach my $t (@targets) { |
35
|
0
|
|
|
|
|
|
my @ignore = $t->select("/[!\@heading]"); |
36
|
0
|
|
|
|
|
|
my @to_sort = $t->select("/[\@heading]"); |
37
|
|
|
|
|
|
|
|
38
|
0
|
|
|
|
|
|
$t->clear; |
39
|
0
|
|
|
|
|
|
$t->nest(@ignore); |
40
|
0
|
|
|
|
|
|
$t->nest( |
41
|
|
|
|
|
|
|
sort { |
42
|
0
|
|
|
|
|
|
$a->param('heading')->pod cmp |
43
|
|
|
|
|
|
|
$b->param('heading')->pod |
44
|
|
|
|
|
|
|
} @to_sort |
45
|
|
|
|
|
|
|
); |
46
|
|
|
|
|
|
|
} |
47
|
0
|
|
|
|
|
|
return $pa; |
48
|
|
|
|
|
|
|
} |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
=head1 AUTHOR |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
Ben Lilburne |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
Copyright (C) 2009 Ben Lilburne |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
This program is free software; you can redistribute it and/or modify |
59
|
|
|
|
|
|
|
it under the same terms as Perl itself. |
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
=cut |
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
1; |