line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
3
|
|
|
3
|
|
92446
|
use strict; |
|
3
|
|
|
|
|
7
|
|
|
3
|
|
|
|
|
119
|
|
2
|
3
|
|
|
3
|
|
17
|
use warnings; |
|
3
|
|
|
|
|
7
|
|
|
3
|
|
|
|
|
100
|
|
3
|
3
|
|
|
3
|
|
3114
|
use utf8; |
|
3
|
|
|
|
|
31
|
|
|
3
|
|
|
|
|
17
|
|
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
package GraphViz2::Abstract::Edge; |
6
|
|
|
|
|
|
|
BEGIN { |
7
|
3
|
|
|
3
|
|
309
|
$GraphViz2::Abstract::Edge::AUTHORITY = 'cpan:KENTNL'; |
8
|
|
|
|
|
|
|
} |
9
|
|
|
|
|
|
|
{ |
10
|
|
|
|
|
|
|
$GraphViz2::Abstract::Edge::VERSION = '0.002000'; |
11
|
|
|
|
|
|
|
} |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
# ABSTRACT: Deal with edges independent of a Graph |
14
|
|
|
|
|
|
|
|
15
|
3
|
|
|
3
|
|
4340
|
use GraphViz2::Abstract::Util::Constants; |
|
3
|
|
|
|
|
3768
|
|
|
3
|
|
|
|
|
1630
|
|
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
our @CARP_NOT; |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
use Class::Tiny { |
21
|
3
|
|
|
|
|
276
|
URL => NONE, |
22
|
|
|
|
|
|
|
arrowhead => 'normal', |
23
|
|
|
|
|
|
|
arrowsize => 0.0, |
24
|
|
|
|
|
|
|
arrowtail => 'normal', |
25
|
|
|
|
|
|
|
color => 'black', |
26
|
|
|
|
|
|
|
colorscheme => EMPTY_STRING, |
27
|
|
|
|
|
|
|
comment => EMPTY_STRING, |
28
|
|
|
|
|
|
|
constraint => TRUE, |
29
|
|
|
|
|
|
|
decorate => FALSE, |
30
|
|
|
|
|
|
|
dir => UNKNOWN, |
31
|
|
|
|
|
|
|
edgeURL => EMPTY_STRING, |
32
|
|
|
|
|
|
|
edgehref => EMPTY_STRING, |
33
|
|
|
|
|
|
|
edgetarget => NONE, |
34
|
|
|
|
|
|
|
edgetooltip => EMPTY_STRING, |
35
|
|
|
|
|
|
|
fillcolor => UNKNOWN, |
36
|
|
|
|
|
|
|
fontcolor => 'black', |
37
|
|
|
|
|
|
|
fontname => 'Times-Roman', |
38
|
|
|
|
|
|
|
fontsize => 14.0, |
39
|
|
|
|
|
|
|
headURL => EMPTY_STRING, |
40
|
|
|
|
|
|
|
head_lp => UNKNOWN, |
41
|
|
|
|
|
|
|
headclip => TRUE, |
42
|
|
|
|
|
|
|
headhref => EMPTY_STRING, |
43
|
|
|
|
|
|
|
headlabel => EMPTY_STRING, |
44
|
|
|
|
|
|
|
headport => 'center', |
45
|
|
|
|
|
|
|
headtarget => NONE, |
46
|
|
|
|
|
|
|
headtooltip => EMPTY_STRING, |
47
|
|
|
|
|
|
|
href => EMPTY_STRING, |
48
|
|
|
|
|
|
|
id => EMPTY_STRING, |
49
|
|
|
|
|
|
|
label => EMPTY_STRING, |
50
|
|
|
|
|
|
|
labelURL => EMPTY_STRING, |
51
|
|
|
|
|
|
|
labelangle => -25.0, |
52
|
|
|
|
|
|
|
labeldistance => 1.0, |
53
|
|
|
|
|
|
|
labelfloat => FALSE, |
54
|
|
|
|
|
|
|
labelfontcolor => 'black', |
55
|
|
|
|
|
|
|
labelfontname => 'Times-Roman', |
56
|
|
|
|
|
|
|
labelfontsize => 14.0, |
57
|
|
|
|
|
|
|
labelhref => EMPTY_STRING, |
58
|
|
|
|
|
|
|
labeltarget => NONE, |
59
|
|
|
|
|
|
|
labeltooltip => EMPTY_STRING, |
60
|
|
|
|
|
|
|
layer => EMPTY_STRING, |
61
|
|
|
|
|
|
|
len => UNKNOWN, # backend dependent |
62
|
|
|
|
|
|
|
lhead => EMPTY_STRING, |
63
|
|
|
|
|
|
|
lp => UNKNOWN, |
64
|
|
|
|
|
|
|
ltail => EMPTY_STRING, |
65
|
|
|
|
|
|
|
minlen => 1, |
66
|
|
|
|
|
|
|
nojustify => FALSE, |
67
|
|
|
|
|
|
|
penwidth => 1.0, |
68
|
|
|
|
|
|
|
pos => UNKNOWN, |
69
|
|
|
|
|
|
|
samehead => EMPTY_STRING, |
70
|
|
|
|
|
|
|
sametail => EMPTY_STRING, |
71
|
|
|
|
|
|
|
showboxes => 0, |
72
|
|
|
|
|
|
|
style => EMPTY_STRING, |
73
|
|
|
|
|
|
|
tailURL => EMPTY_STRING, |
74
|
|
|
|
|
|
|
tail_lp => UNKNOWN, |
75
|
|
|
|
|
|
|
tailclip => TRUE, |
76
|
|
|
|
|
|
|
tailhref => EMPTY_STRING, |
77
|
|
|
|
|
|
|
taillabel => EMPTY_STRING, |
78
|
|
|
|
|
|
|
tailport => 'center', |
79
|
|
|
|
|
|
|
tailtarget => NONE, |
80
|
|
|
|
|
|
|
tailtooltip => EMPTY_STRING, |
81
|
|
|
|
|
|
|
target => NONE, |
82
|
|
|
|
|
|
|
tooltip => EMPTY_STRING, |
83
|
|
|
|
|
|
|
weight => 1, |
84
|
|
|
|
|
|
|
xlabel => EMPTY_STRING, |
85
|
|
|
|
|
|
|
xlp => UNKNOWN, |
86
|
3
|
|
|
3
|
|
2829
|
}; |
|
3
|
|
|
|
|
11590
|
|
87
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
|
89
|
3
|
|
|
3
|
|
30453
|
use Scalar::Util qw(blessed); |
|
3
|
|
|
|
|
10
|
|
|
3
|
|
|
|
|
424
|
|
90
|
3
|
|
|
3
|
|
18
|
use Scalar::Util qw(refaddr); |
|
3
|
|
|
|
|
7
|
|
|
3
|
|
|
|
|
2417
|
|
91
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
sub _is_equal { |
93
|
260
|
|
|
260
|
|
434
|
my ( $self, $a_ref, $b_ref ) = @_; |
94
|
|
|
|
|
|
|
|
95
|
260
|
50
|
33
|
|
|
1066
|
return if defined $a_ref and not defined $b_ref; |
96
|
260
|
50
|
33
|
|
|
598
|
return if not defined $a_ref and defined $b_ref; |
97
|
260
|
0
|
33
|
|
|
688
|
return 1 if not defined $a_ref and not defined $b_ref; |
98
|
|
|
|
|
|
|
|
99
|
|
|
|
|
|
|
## A and B are both defined. |
100
|
|
|
|
|
|
|
|
101
|
260
|
50
|
66
|
|
|
996
|
return if not ref $a_ref and ref $b_ref; |
102
|
260
|
50
|
66
|
|
|
796
|
return if ref $a_ref and not $b_ref; |
103
|
|
|
|
|
|
|
|
104
|
260
|
50
|
66
|
|
|
667
|
if ( not ref $a_ref and not ref $b_ref ) { |
105
|
204
|
|
|
|
|
1061
|
return $a_ref eq $b_ref; |
106
|
|
|
|
|
|
|
} |
107
|
|
|
|
|
|
|
|
108
|
|
|
|
|
|
|
## A and B are both refs. |
109
|
56
|
|
|
|
|
359
|
return refaddr $a_ref eq refaddr $b_ref; |
110
|
|
|
|
|
|
|
} |
111
|
|
|
|
|
|
|
|
112
|
|
|
|
|
|
|
sub _is_magic { |
113
|
197
|
|
|
197
|
|
275
|
my ( $self, $value ) = @_; |
114
|
197
|
50
|
|
|
|
352
|
return if not defined $value; |
115
|
197
|
100
|
|
|
|
562
|
return if not ref $value; |
116
|
42
|
|
|
|
|
83
|
my $addr = refaddr $value; |
117
|
42
|
100
|
|
|
|
201
|
return 1 if $addr eq refaddr UNKNOWN; |
118
|
18
|
50
|
|
|
|
98
|
return 1 if $addr eq refaddr NONE; |
119
|
0
|
|
|
|
|
0
|
return; |
120
|
|
|
|
|
|
|
} |
121
|
|
|
|
|
|
|
|
122
|
|
|
|
|
|
|
sub _foreach_attr { |
123
|
7
|
|
|
7
|
|
15
|
my ( $self, $callback ) = @_; |
124
|
7
|
50
|
|
|
|
48
|
if ( not blessed($self) ) { |
125
|
0
|
|
|
|
|
0
|
require Carp; |
126
|
0
|
|
|
|
|
0
|
local @CARP_NOT = 'GraphViz2::Abstract::Edge'; |
127
|
0
|
|
|
|
|
0
|
Carp::croak('Can\'t call as_hash on a class'); |
128
|
|
|
|
|
|
|
} |
129
|
7
|
|
|
|
|
30
|
my $class = blessed($self); |
130
|
7
|
|
|
|
|
44
|
my @attrs = Class::Tiny->get_all_attributes_for($class); |
131
|
7
|
|
|
|
|
1105
|
my $defaults = Class::Tiny->get_all_attribute_defaults_for(__PACKAGE__); |
132
|
7
|
|
|
|
|
1664
|
for my $attr (@attrs) { |
133
|
455
|
|
|
|
|
12392
|
my $value = $self->$attr(); |
134
|
455
|
|
|
|
|
4008
|
my $has_default = exists $defaults->{$attr}; |
135
|
455
|
|
|
|
|
470
|
my $default; |
136
|
455
|
50
|
|
|
|
898
|
if ($has_default) { |
137
|
455
|
|
|
|
|
731
|
$default = $defaults->{$attr}; |
138
|
|
|
|
|
|
|
} |
139
|
455
|
|
|
|
|
820
|
$callback->( $attr, $value, $has_default, $default ); |
140
|
|
|
|
|
|
|
} |
141
|
7
|
|
|
|
|
124
|
return $self; |
142
|
|
|
|
|
|
|
} |
143
|
|
|
|
|
|
|
|
144
|
|
|
|
|
|
|
|
145
|
|
|
|
|
|
|
sub as_hash { |
146
|
4
|
|
|
4
|
1
|
767
|
my ($self) = @_; |
147
|
4
|
|
|
|
|
10
|
my %output; |
148
|
|
|
|
|
|
|
|
149
|
|
|
|
|
|
|
$self->_foreach_attr( |
150
|
|
|
|
|
|
|
sub { |
151
|
260
|
|
|
260
|
|
520
|
my ( $attr, $value, $has_default, $default ) = @_; |
152
|
260
|
50
|
|
|
|
469
|
if ( not $has_default ) { |
153
|
0
|
0
|
|
|
|
0
|
return if $self->_is_magic($value); |
154
|
0
|
|
|
|
|
0
|
$output{$attr} = $value; |
155
|
0
|
|
|
|
|
0
|
return; |
156
|
|
|
|
|
|
|
} |
157
|
260
|
100
|
|
|
|
539
|
return if $self->_is_equal( $value, $default ); |
158
|
2
|
50
|
|
|
|
13
|
return if $self->_is_magic($value); |
159
|
2
|
|
|
|
|
8
|
$output{$attr} = $value; |
160
|
|
|
|
|
|
|
} |
161
|
4
|
|
|
|
|
41
|
); |
162
|
4
|
|
|
|
|
63
|
return \%output; |
163
|
|
|
|
|
|
|
} |
164
|
|
|
|
|
|
|
|
165
|
|
|
|
|
|
|
|
166
|
|
|
|
|
|
|
sub as_canon_hash { |
167
|
3
|
|
|
3
|
1
|
8
|
my ($self) = @_; |
168
|
3
|
|
|
|
|
26
|
my %output; |
169
|
|
|
|
|
|
|
$self->_foreach_attr( |
170
|
|
|
|
|
|
|
sub { |
171
|
195
|
|
|
195
|
|
296
|
my ( $attr, $value, $has_default, $default ) = @_; |
172
|
195
|
100
|
|
|
|
435
|
return if $self->_is_magic($value); |
173
|
153
|
|
|
|
|
436
|
$output{$attr} = $value; |
174
|
|
|
|
|
|
|
} |
175
|
3
|
|
|
|
|
24
|
); |
176
|
3
|
|
|
|
|
45
|
return \%output; |
177
|
|
|
|
|
|
|
|
178
|
|
|
|
|
|
|
} |
179
|
|
|
|
|
|
|
|
180
|
|
|
|
|
|
|
1; |
181
|
|
|
|
|
|
|
|
182
|
|
|
|
|
|
|
__END__ |