line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
3
|
|
|
3
|
|
57553
|
use strict; |
|
3
|
|
|
|
|
7
|
|
|
3
|
|
|
|
|
122
|
|
2
|
3
|
|
|
3
|
|
16
|
use warnings; |
|
3
|
|
|
|
|
6
|
|
|
3
|
|
|
|
|
95
|
|
3
|
3
|
|
|
3
|
|
3373
|
use utf8; |
|
3
|
|
|
|
|
33
|
|
|
3
|
|
|
|
|
20
|
|
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
package GraphViz2::Abstract::Node; |
6
|
|
|
|
|
|
|
BEGIN { |
7
|
3
|
|
|
3
|
|
749
|
$GraphViz2::Abstract::Node::AUTHORITY = 'cpan:KENTNL'; |
8
|
|
|
|
|
|
|
} |
9
|
|
|
|
|
|
|
{ |
10
|
|
|
|
|
|
|
$GraphViz2::Abstract::Node::VERSION = '0.002000'; |
11
|
|
|
|
|
|
|
} |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
# ABSTRACT: Deal with nodes independent of a Graph |
14
|
|
|
|
|
|
|
|
15
|
3
|
|
|
3
|
|
3000
|
use GraphViz2::Abstract::Util::Constants; |
|
3
|
|
|
|
|
3709
|
|
|
3
|
|
|
|
|
1026
|
|
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
our @CARP_NOT; |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
use Class::Tiny { |
21
|
3
|
|
|
|
|
178
|
URL => NONE, |
22
|
|
|
|
|
|
|
area => 1.0, |
23
|
|
|
|
|
|
|
color => 'black', |
24
|
|
|
|
|
|
|
colorscheme => EMPTY_STRING, |
25
|
|
|
|
|
|
|
comment => EMPTY_STRING, |
26
|
|
|
|
|
|
|
distortion => 0.0, |
27
|
|
|
|
|
|
|
fillcolor => 'lightgrey', |
28
|
|
|
|
|
|
|
fixedsize => FALSE, |
29
|
|
|
|
|
|
|
fontcolor => 'black', |
30
|
|
|
|
|
|
|
fontname => 'Times-Roman', |
31
|
|
|
|
|
|
|
fontsize => 14.0, |
32
|
|
|
|
|
|
|
gradientangle => EMPTY_STRING, |
33
|
|
|
|
|
|
|
group => EMPTY_STRING, |
34
|
|
|
|
|
|
|
height => 0.5, |
35
|
|
|
|
|
|
|
href => EMPTY_STRING, |
36
|
|
|
|
|
|
|
id => EMPTY_STRING, |
37
|
|
|
|
|
|
|
image => EMPTY_STRING, |
38
|
|
|
|
|
|
|
imagescale => FALSE, |
39
|
|
|
|
|
|
|
label => q[\\N], |
40
|
|
|
|
|
|
|
labelloc => q[c], |
41
|
|
|
|
|
|
|
layer => EMPTY_STRING, |
42
|
|
|
|
|
|
|
margin => UNKNOWN, |
43
|
|
|
|
|
|
|
nojustify => FALSE, |
44
|
|
|
|
|
|
|
ordering => EMPTY_STRING, |
45
|
|
|
|
|
|
|
orientation => 0.0, |
46
|
|
|
|
|
|
|
penwidth => 1.0, |
47
|
|
|
|
|
|
|
peripheries => UNKNOWN, |
48
|
|
|
|
|
|
|
pos => UNKNOWN, |
49
|
|
|
|
|
|
|
rects => UNKNOWN, |
50
|
|
|
|
|
|
|
regular => FALSE, |
51
|
|
|
|
|
|
|
root => FALSE, |
52
|
|
|
|
|
|
|
samplepoints => UNKNOWN, |
53
|
|
|
|
|
|
|
shape => 'ellipse', |
54
|
|
|
|
|
|
|
shapefile => EMPTY_STRING, |
55
|
|
|
|
|
|
|
showboxes => 0, |
56
|
|
|
|
|
|
|
sides => 4, |
57
|
|
|
|
|
|
|
skew => 0.0, |
58
|
|
|
|
|
|
|
sortv => 0, |
59
|
|
|
|
|
|
|
style => EMPTY_STRING, |
60
|
|
|
|
|
|
|
target => NONE, |
61
|
|
|
|
|
|
|
tooltip => EMPTY_STRING, |
62
|
|
|
|
|
|
|
vertices => UNKNOWN, |
63
|
|
|
|
|
|
|
width => 0.75, |
64
|
|
|
|
|
|
|
xlabel => EMPTY_STRING, |
65
|
|
|
|
|
|
|
xlp => EMPTY_STRING, |
66
|
|
|
|
|
|
|
z => 0.0, |
67
|
3
|
|
|
3
|
|
2860
|
}; |
|
3
|
|
|
|
|
12182
|
|
68
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
|
70
|
3
|
|
|
3
|
|
27820
|
use Scalar::Util qw(blessed); |
|
3
|
|
|
|
|
7
|
|
|
3
|
|
|
|
|
646
|
|
71
|
3
|
|
|
3
|
|
17
|
use Scalar::Util qw(refaddr); |
|
3
|
|
|
|
|
6
|
|
|
3
|
|
|
|
|
2610
|
|
72
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
sub _is_equal { |
74
|
184
|
|
|
184
|
|
251
|
my ( $self, $a_ref, $b_ref ) = @_; |
75
|
|
|
|
|
|
|
|
76
|
184
|
50
|
33
|
|
|
758
|
return if defined $a_ref and not defined $b_ref; |
77
|
184
|
50
|
33
|
|
|
395
|
return if not defined $a_ref and defined $b_ref; |
78
|
184
|
0
|
33
|
|
|
314
|
return 1 if not defined $a_ref and not defined $b_ref; |
79
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
## A and B are both defined. |
81
|
|
|
|
|
|
|
|
82
|
184
|
50
|
66
|
|
|
659
|
return if not ref $a_ref and ref $b_ref; |
83
|
184
|
50
|
66
|
|
|
489
|
return if ref $a_ref and not $b_ref; |
84
|
|
|
|
|
|
|
|
85
|
184
|
50
|
66
|
|
|
503
|
if ( not ref $a_ref and not ref $b_ref ) { |
86
|
152
|
|
|
|
|
862
|
return $a_ref eq $b_ref; |
87
|
|
|
|
|
|
|
} |
88
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
## A and B are both refs. |
90
|
32
|
|
|
|
|
209
|
return refaddr $a_ref eq refaddr $b_ref; |
91
|
|
|
|
|
|
|
} |
92
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
sub _is_magic { |
94
|
140
|
|
|
140
|
|
194
|
my ( $self, $value ) = @_; |
95
|
140
|
50
|
|
|
|
263
|
return if not defined $value; |
96
|
140
|
100
|
|
|
|
443
|
return if not ref $value; |
97
|
24
|
|
|
|
|
52
|
my $addr = refaddr $value; |
98
|
24
|
100
|
|
|
|
144
|
return 1 if $addr eq refaddr UNKNOWN; |
99
|
6
|
50
|
|
|
|
36
|
return 1 if $addr eq refaddr NONE; |
100
|
0
|
|
|
|
|
0
|
return; |
101
|
|
|
|
|
|
|
} |
102
|
|
|
|
|
|
|
|
103
|
|
|
|
|
|
|
sub _foreach_attr { |
104
|
7
|
|
|
7
|
|
14
|
my ( $self, $callback ) = @_; |
105
|
7
|
50
|
|
|
|
43
|
if ( not blessed($self) ) { |
106
|
0
|
|
|
|
|
0
|
require Carp; |
107
|
0
|
|
|
|
|
0
|
local @CARP_NOT = 'GraphViz2::Abstract::Node'; |
108
|
0
|
|
|
|
|
0
|
Carp::croak('Can\'t call as_hash on a class'); |
109
|
|
|
|
|
|
|
} |
110
|
7
|
|
|
|
|
76
|
my $class = blessed($self); |
111
|
7
|
|
|
|
|
35
|
my @attrs = Class::Tiny->get_all_attributes_for($class); |
112
|
7
|
|
|
|
|
780
|
my $defaults = Class::Tiny->get_all_attribute_defaults_for(__PACKAGE__); |
113
|
7
|
|
|
|
|
1178
|
for my $attr (@attrs) { |
114
|
322
|
|
|
|
|
8382
|
my $value = $self->$attr(); |
115
|
322
|
|
|
|
|
2940
|
my $has_default = exists $defaults->{$attr}; |
116
|
322
|
|
|
|
|
364
|
my $default; |
117
|
322
|
50
|
|
|
|
639
|
if ($has_default) { |
118
|
322
|
|
|
|
|
490
|
$default = $defaults->{$attr}; |
119
|
|
|
|
|
|
|
} |
120
|
322
|
|
|
|
|
665
|
$callback->( $attr, $value, $has_default, $default ); |
121
|
|
|
|
|
|
|
} |
122
|
7
|
|
|
|
|
90
|
return $self; |
123
|
|
|
|
|
|
|
} |
124
|
|
|
|
|
|
|
|
125
|
|
|
|
|
|
|
|
126
|
|
|
|
|
|
|
sub as_hash { |
127
|
4
|
|
|
4
|
1
|
527
|
my ($self) = @_; |
128
|
4
|
|
|
|
|
7
|
my %output; |
129
|
|
|
|
|
|
|
|
130
|
|
|
|
|
|
|
$self->_foreach_attr( |
131
|
|
|
|
|
|
|
sub { |
132
|
184
|
|
|
184
|
|
359
|
my ( $attr, $value, $has_default, $default ) = @_; |
133
|
184
|
50
|
|
|
|
343
|
if ( not $has_default ) { |
134
|
0
|
0
|
|
|
|
0
|
return if $self->_is_magic($value); |
135
|
0
|
|
|
|
|
0
|
$output{$attr} = $value; |
136
|
0
|
|
|
|
|
0
|
return; |
137
|
|
|
|
|
|
|
} |
138
|
184
|
100
|
|
|
|
386
|
return if $self->_is_equal( $value, $default ); |
139
|
2
|
50
|
|
|
|
11
|
return if $self->_is_magic($value); |
140
|
2
|
|
|
|
|
6
|
$output{$attr} = $value; |
141
|
|
|
|
|
|
|
} |
142
|
4
|
|
|
|
|
37
|
); |
143
|
4
|
|
|
|
|
50
|
return \%output; |
144
|
|
|
|
|
|
|
} |
145
|
|
|
|
|
|
|
|
146
|
|
|
|
|
|
|
|
147
|
|
|
|
|
|
|
sub as_canon_hash { |
148
|
3
|
|
|
3
|
1
|
6
|
my ($self) = @_; |
149
|
3
|
|
|
|
|
27
|
my %output; |
150
|
|
|
|
|
|
|
$self->_foreach_attr( |
151
|
|
|
|
|
|
|
sub { |
152
|
138
|
|
|
138
|
|
226
|
my ( $attr, $value, $has_default, $default ) = @_; |
153
|
138
|
100
|
|
|
|
271
|
return if $self->_is_magic($value); |
154
|
114
|
|
|
|
|
353
|
$output{$attr} = $value; |
155
|
|
|
|
|
|
|
} |
156
|
3
|
|
|
|
|
23
|
); |
157
|
3
|
|
|
|
|
32
|
return \%output; |
158
|
|
|
|
|
|
|
|
159
|
|
|
|
|
|
|
} |
160
|
|
|
|
|
|
|
|
161
|
|
|
|
|
|
|
|
162
|
|
|
|
|
|
|
1; |
163
|
|
|
|
|
|
|
|
164
|
|
|
|
|
|
|
__END__ |