| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package Graph::Writer::DSM::HTML; |
|
2
|
|
|
|
|
|
|
{ |
|
3
|
|
|
|
|
|
|
$Graph::Writer::DSM::HTML::VERSION = '0.006'; |
|
4
|
|
|
|
|
|
|
} |
|
5
|
1
|
|
|
1
|
|
1453466
|
use Modern::Perl; |
|
|
1
|
|
|
|
|
743
|
|
|
|
1
|
|
|
|
|
7
|
|
|
6
|
1
|
|
|
1
|
|
246
|
use base qw( Graph::Writer ); |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
1032
|
|
|
7
|
1
|
|
|
1
|
|
1604
|
use Mojo::Template; |
|
|
1
|
|
|
|
|
46094
|
|
|
|
1
|
|
|
|
|
8
|
|
|
8
|
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
local $/ = undef; |
|
10
|
|
|
|
|
|
|
our $TEMPLATE = <DATA>; |
|
11
|
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
=head1 NAME |
|
13
|
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
Graph::Writer::DSM::HTML - draw graph as a DSM matrix in HTML format |
|
15
|
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
=head1 VERSION |
|
17
|
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
version 0.006 |
|
19
|
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
=head1 DESCRIPTION |
|
21
|
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
See L<Graph::Writer::DSM>. |
|
23
|
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
=head1 SYNOPSIS |
|
25
|
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
See L<Graph::Writer::DSM>. |
|
27
|
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
=head1 METHODS |
|
29
|
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
=head1 new() |
|
31
|
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
Like L<Graph::Writer::DSM>, this module provide some extra parameters |
|
33
|
|
|
|
|
|
|
to new() method. |
|
34
|
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
Supported parameters are: |
|
36
|
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
=over 4 |
|
38
|
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
=item title |
|
40
|
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
The title of HTML page. Default: 'Design Structure Matrix'. |
|
42
|
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
=back |
|
44
|
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
=cut |
|
46
|
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
sub _init { |
|
48
|
5
|
|
|
5
|
|
29321
|
my ($self, %param) = @_; |
|
49
|
5
|
|
|
|
|
29
|
$self->SUPER::_init(); |
|
50
|
5
|
|
100
|
|
|
59
|
$self->{title} = $param{title} // 'Design Structure Matrix'; |
|
51
|
|
|
|
|
|
|
} |
|
52
|
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
=head1 write_graph() |
|
54
|
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
See L<Graph::Writer::DSM>. |
|
56
|
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
=cut |
|
58
|
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
sub _write_graph { |
|
60
|
4
|
|
|
4
|
|
788
|
my ($self, $graph, $FILE) = @_; |
|
61
|
4
|
|
|
|
|
86
|
my $template = Mojo::Template->new; |
|
62
|
4
|
|
|
|
|
50
|
my $output = $template->render($TEMPLATE, $graph, $self->{title}); |
|
63
|
4
|
|
|
|
|
24304
|
print $FILE $output; |
|
64
|
|
|
|
|
|
|
} |
|
65
|
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
1; |
|
67
|
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
=head1 SEE ALSO |
|
69
|
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
L<Graph>, L<Graph::Writer>, L<Chart::Gnuplot>. |
|
71
|
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
=head1 CREDITS |
|
73
|
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
Antonio Terceiro <terceiro AT softwarelivre.org> |
|
75
|
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
=head1 COPYRIGHT |
|
77
|
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
Copyright (c) 2013, Joenio Costa |
|
79
|
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
=cut |
|
81
|
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
__DATA__ |
|
83
|
|
|
|
|
|
|
% my ($graph, $title) = @_; |
|
84
|
|
|
|
|
|
|
% my @modules = sort($graph->vertices); |
|
85
|
|
|
|
|
|
|
<!DOCTYPE html> |
|
86
|
|
|
|
|
|
|
<html> |
|
87
|
|
|
|
|
|
|
<body> |
|
88
|
|
|
|
|
|
|
<head> |
|
89
|
|
|
|
|
|
|
<meta http-equiv="Content-Type" content="text/html; charset=utf8"/> |
|
90
|
|
|
|
|
|
|
<title><%= $title %></title> |
|
91
|
|
|
|
|
|
|
<style type="text/css"> |
|
92
|
|
|
|
|
|
|
table { |
|
93
|
|
|
|
|
|
|
border-collapse: collapse; |
|
94
|
|
|
|
|
|
|
} |
|
95
|
|
|
|
|
|
|
th { |
|
96
|
|
|
|
|
|
|
background: #eeeeec; |
|
97
|
|
|
|
|
|
|
} |
|
98
|
|
|
|
|
|
|
td, th { |
|
99
|
|
|
|
|
|
|
border: 1px solid #d3d7cf; |
|
100
|
|
|
|
|
|
|
min-width: 20px; |
|
101
|
|
|
|
|
|
|
text-align: center; |
|
102
|
|
|
|
|
|
|
vertical-align: center; |
|
103
|
|
|
|
|
|
|
} |
|
104
|
|
|
|
|
|
|
th:first-child { |
|
105
|
|
|
|
|
|
|
text-align: right; |
|
106
|
|
|
|
|
|
|
padding: 0px 5px; |
|
107
|
|
|
|
|
|
|
} |
|
108
|
|
|
|
|
|
|
td.empty { |
|
109
|
|
|
|
|
|
|
border: none; |
|
110
|
|
|
|
|
|
|
} |
|
111
|
|
|
|
|
|
|
</style> |
|
112
|
|
|
|
|
|
|
</head> |
|
113
|
|
|
|
|
|
|
<h1><%= $title %></h1> |
|
114
|
|
|
|
|
|
|
<table> |
|
115
|
|
|
|
|
|
|
<tr> |
|
116
|
|
|
|
|
|
|
<td class='empty'></td> |
|
117
|
|
|
|
|
|
|
% foreach my $m (@modules) { |
|
118
|
|
|
|
|
|
|
<th title='<%= $m %>'> </th> |
|
119
|
|
|
|
|
|
|
% } |
|
120
|
|
|
|
|
|
|
</tr> |
|
121
|
|
|
|
|
|
|
% foreach my $m1 (@modules) { |
|
122
|
|
|
|
|
|
|
<tr> |
|
123
|
|
|
|
|
|
|
<th><%= $m1 %></th> |
|
124
|
|
|
|
|
|
|
% foreach my $m2 (@modules) { |
|
125
|
|
|
|
|
|
|
% if ($m1 eq $m2) { |
|
126
|
|
|
|
|
|
|
<th title='<%= $m1 %>'> </th> |
|
127
|
|
|
|
|
|
|
% } |
|
128
|
|
|
|
|
|
|
% elsif ($graph->has_edge($m1, $m2)) { |
|
129
|
|
|
|
|
|
|
<td class='dependency' title='<%= $m1 %> → <%= $m2 %>'>●</td> |
|
130
|
|
|
|
|
|
|
% } else { |
|
131
|
|
|
|
|
|
|
<td> </td> |
|
132
|
|
|
|
|
|
|
% } |
|
133
|
|
|
|
|
|
|
% } |
|
134
|
|
|
|
|
|
|
</tr> |
|
135
|
|
|
|
|
|
|
% } |
|
136
|
|
|
|
|
|
|
</table> |
|
137
|
|
|
|
|
|
|
</body> |
|
138
|
|
|
|
|
|
|
</html> |