line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Graph::Reader::LoadClassHierarchy; |
2
|
|
|
|
|
|
|
|
3
|
2
|
|
|
2
|
|
60492
|
use strict; |
|
2
|
|
|
|
|
6
|
|
|
2
|
|
|
|
|
74
|
|
4
|
2
|
|
|
2
|
|
11
|
use warnings; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
51
|
|
5
|
2
|
|
|
2
|
|
2544
|
use Graph; |
|
2
|
|
|
|
|
362023
|
|
|
2
|
|
|
|
|
434
|
|
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
=head1 NAME |
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
Graph::Reader::LoadClassHierarchy - load Graphs from class hierarchies |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
=cut |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
our $VERSION = '0.01'; |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
=head1 SYNOPSIS |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
use Graph; |
18
|
|
|
|
|
|
|
use Graph::Reader::LoadClassHierarchy; |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
my $reader = Graph::Reader::LoadClassHierarchy->new; |
21
|
|
|
|
|
|
|
my $graph = $reader->read_graph('Foo::Bar'); |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
=head1 DESCRIPTION |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
B is a class for loading a class hierarchy |
26
|
|
|
|
|
|
|
into a directed graph. |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
=head1 METHODS |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
=head2 new |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
my $reader = Graph::Reader::LoadClassHierarchy->new; |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
Constructor - generate a new reader instance. Doesn't take any arguments. |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
=cut |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
sub new { |
39
|
1
|
|
|
1
|
1
|
16
|
my ($class) = @_; |
40
|
|
|
|
|
|
|
|
41
|
1
|
|
|
|
|
3
|
my $self = bless {}, $class; |
42
|
1
|
|
|
|
|
3
|
return $self; |
43
|
|
|
|
|
|
|
} |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
=head2 read_graph |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
my $graph = $reader->read_graph( $class_name ); |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
Builds a graph with the class hierarchy of I<$class_name>. |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
=cut |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
sub read_graph { |
54
|
1
|
|
|
1
|
1
|
830
|
my ($self, $class_name) = @_; |
55
|
|
|
|
|
|
|
|
56
|
1
|
|
|
|
|
10
|
my $graph = Graph->new; |
57
|
|
|
|
|
|
|
|
58
|
1
|
|
|
|
|
255
|
$graph->add_vertex($class_name); |
59
|
1
|
|
|
|
|
43
|
$self->_read_graph($graph, $class_name); |
60
|
|
|
|
|
|
|
|
61
|
1
|
|
|
|
|
3
|
return $graph; |
62
|
|
|
|
|
|
|
} |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
sub _read_graph { |
65
|
4
|
|
|
4
|
|
6
|
my ($self, $graph, $class_name) = @_; |
66
|
|
|
|
|
|
|
|
67
|
4
|
|
|
|
|
5
|
my @superclasses; |
68
|
|
|
|
|
|
|
{ |
69
|
2
|
|
|
2
|
|
22
|
no strict 'refs'; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
280
|
|
|
4
|
|
|
|
|
5
|
|
70
|
4
|
|
|
|
|
4
|
@superclasses = @{ $class_name . '::ISA' }; |
|
4
|
|
|
|
|
23
|
|
71
|
|
|
|
|
|
|
} |
72
|
|
|
|
|
|
|
|
73
|
4
|
|
|
|
|
9
|
for my $superclass (@superclasses) { |
74
|
3
|
|
|
|
|
8
|
$graph->add_vertex($superclass); |
75
|
3
|
|
|
|
|
83
|
$graph->add_edge( $class_name => $superclass ); |
76
|
|
|
|
|
|
|
|
77
|
3
|
|
|
|
|
142
|
$self->_read_graph($graph, $superclass); |
78
|
|
|
|
|
|
|
} |
79
|
|
|
|
|
|
|
} |
80
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
=head1 AUTHOR |
82
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
Florian Ragwitz Erafl@debian.orgE |
84
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
=head1 BUGS |
86
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
Please report any bugs or feature requests to |
88
|
|
|
|
|
|
|
C, or through the web interface at |
89
|
|
|
|
|
|
|
L. |
90
|
|
|
|
|
|
|
I will be notified, and then you'll automatically be notified of progress on |
91
|
|
|
|
|
|
|
your bug as I make changes. |
92
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
=head1 SUPPORT |
94
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
You can find documentation for this module with the perldoc command. |
96
|
|
|
|
|
|
|
|
97
|
|
|
|
|
|
|
perldoc Graph::Reader::LoadClassHierarchy |
98
|
|
|
|
|
|
|
|
99
|
|
|
|
|
|
|
You can also look for information at: |
100
|
|
|
|
|
|
|
|
101
|
|
|
|
|
|
|
=over 4 |
102
|
|
|
|
|
|
|
|
103
|
|
|
|
|
|
|
=item * AnnoCPAN: Annotated CPAN documentation |
104
|
|
|
|
|
|
|
|
105
|
|
|
|
|
|
|
L |
106
|
|
|
|
|
|
|
|
107
|
|
|
|
|
|
|
=item * CPAN Ratings |
108
|
|
|
|
|
|
|
|
109
|
|
|
|
|
|
|
L |
110
|
|
|
|
|
|
|
|
111
|
|
|
|
|
|
|
=item * RT: CPAN's request tracker |
112
|
|
|
|
|
|
|
|
113
|
|
|
|
|
|
|
L |
114
|
|
|
|
|
|
|
|
115
|
|
|
|
|
|
|
=item * Search CPAN |
116
|
|
|
|
|
|
|
|
117
|
|
|
|
|
|
|
L |
118
|
|
|
|
|
|
|
|
119
|
|
|
|
|
|
|
=back |
120
|
|
|
|
|
|
|
|
121
|
|
|
|
|
|
|
=head1 COPYRIGHT & LICENSE |
122
|
|
|
|
|
|
|
|
123
|
|
|
|
|
|
|
Copyright 2006 Florian Ragwitz, all rights reserved. |
124
|
|
|
|
|
|
|
|
125
|
|
|
|
|
|
|
This program is free software; you can redistribute it and/or modify it |
126
|
|
|
|
|
|
|
under the same terms as Perl itself. |
127
|
|
|
|
|
|
|
|
128
|
|
|
|
|
|
|
=cut |
129
|
|
|
|
|
|
|
|
130
|
|
|
|
|
|
|
1; # End of Graph::Reader::LoadClassHierarchy |