line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
#!/usr/bin/perl |
2
|
|
|
|
|
|
|
# $Id: Greedy.pm,v 1.2 2003/11/29 14:48:37 nothingmuch Exp $ |
3
|
|
|
|
|
|
|
|
4
|
|
|
|
|
|
|
package Object::Meta::Plugin::Useful::Greedy; |
5
|
|
|
|
|
|
|
|
6
|
1
|
|
|
1
|
|
1197
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
34
|
|
7
|
1
|
|
|
1
|
|
4
|
use warnings; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
25
|
|
8
|
|
|
|
|
|
|
|
9
|
1
|
|
|
1
|
|
4
|
use base 'Object::Meta::Plugin::Useful'; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
522
|
|
10
|
|
|
|
|
|
|
|
11
|
1
|
|
|
1
|
|
5
|
use Devel::Symdump; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
100
|
|
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
sub exports { |
14
|
1
|
|
|
1
|
0
|
18
|
my $self = shift; |
15
|
|
|
|
|
|
|
|
16
|
1
|
|
|
|
|
6
|
return _filter(_collect_functions(ref $self)); |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
sub _collect_functions { |
19
|
4
|
|
|
4
|
|
8
|
my $pkg = shift; |
20
|
4
|
|
|
|
|
635
|
my @f = map { s/.*:://; $_ } Devel::Symdump->new($pkg)->functions();; |
|
12
|
|
|
|
|
33
|
|
|
12
|
|
|
|
|
26
|
|
21
|
|
|
|
|
|
|
|
22
|
4
|
|
|
|
|
22
|
my $isaisa; |
23
|
1
|
|
|
1
|
|
4
|
no strict 'refs'; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
205
|
|
24
|
4
|
|
|
|
|
6
|
foreach $isaisa (@{"$pkg\::ISA"}) { |
|
4
|
|
|
|
|
47
|
|
25
|
3
|
|
|
|
|
14
|
push @f, _collect_functions($isaisa); |
26
|
|
|
|
|
|
|
} |
27
|
4
|
|
|
|
|
21
|
@f; |
28
|
|
|
|
|
|
|
} |
29
|
|
|
|
|
|
|
} |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
sub _filter { |
32
|
1
|
|
|
1
|
|
2
|
my %seen; |
33
|
3
|
|
|
|
|
11
|
return grep { not $seen{$_}++ } grep { !/^(?: |
|
9
|
|
|
|
|
22
|
|
|
12
|
|
|
|
|
24
|
|
34
|
|
|
|
|
|
|
croak | |
35
|
|
|
|
|
|
|
carp | |
36
|
|
|
|
|
|
|
exports | |
37
|
|
|
|
|
|
|
next | |
38
|
|
|
|
|
|
|
init | |
39
|
|
|
|
|
|
|
new |
40
|
1
|
|
|
|
|
3
|
)$/x } grep { /^(?!_)\w/ } @_; |
41
|
|
|
|
|
|
|
} |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
1; # Keep your mother happy. |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
__END__ |