line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Graphviz::DSL::Util; |
2
|
8
|
|
|
8
|
|
42
|
use strict; |
|
8
|
|
|
|
|
13
|
|
|
8
|
|
|
|
|
245
|
|
3
|
8
|
|
|
8
|
|
136
|
use warnings; |
|
8
|
|
|
|
|
34
|
|
|
8
|
|
|
|
|
221
|
|
4
|
|
|
|
|
|
|
|
5
|
8
|
|
|
8
|
|
39
|
use parent qw/Exporter/; |
|
8
|
|
|
|
|
12
|
|
|
8
|
|
|
|
|
39
|
|
6
|
8
|
|
|
8
|
|
333
|
use Carp (); |
|
8
|
|
|
|
|
14
|
|
|
8
|
|
|
|
|
2194
|
|
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
our @EXPORT_OK = qw/parse_id validate_compass/; |
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
my @valid_compasses = qw/n ne e se s sw w nw c _/; |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
sub parse_id { |
13
|
331
|
|
|
331
|
0
|
431
|
my $id_str = shift; |
14
|
|
|
|
|
|
|
|
15
|
331
|
|
|
|
|
569
|
my $id = $id_str; |
16
|
331
|
|
|
|
|
341
|
my ($port, $compass); |
17
|
331
|
100
|
|
|
|
836
|
if ($id =~ m{:}) { |
18
|
12
|
|
|
|
|
37
|
($id, $port, $compass) = split /:/, $id, 3; |
19
|
|
|
|
|
|
|
|
20
|
12
|
100
|
66
|
|
|
51
|
if (defined $port && !defined $compass) { |
21
|
6
|
50
|
|
|
|
10
|
if (grep { $port eq $_ } @valid_compasses) { |
|
60
|
|
|
|
|
79
|
|
22
|
6
|
|
|
|
|
6
|
$compass = $port; |
23
|
6
|
|
|
|
|
9
|
$port = undef; |
24
|
|
|
|
|
|
|
} |
25
|
|
|
|
|
|
|
} |
26
|
|
|
|
|
|
|
} |
27
|
|
|
|
|
|
|
|
28
|
331
|
|
|
|
|
1125
|
return ($id, $port, $compass); |
29
|
|
|
|
|
|
|
} |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
sub validate_compass { |
32
|
21
|
|
|
21
|
0
|
33
|
my $compass = shift; |
33
|
|
|
|
|
|
|
|
34
|
21
|
100
|
|
|
|
37
|
unless (grep { $compass eq $_ } @valid_compasses) { |
|
210
|
|
|
|
|
314
|
|
35
|
1
|
|
|
|
|
156
|
Carp::croak("Invalid compass '$compass'"); |
36
|
|
|
|
|
|
|
} |
37
|
|
|
|
|
|
|
|
38
|
20
|
|
|
|
|
39
|
return $compass; |
39
|
|
|
|
|
|
|
} |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
1; |