lib/Net/NBName/NodeStatus/RR.pm

filter: Statementstmt 78.0% 32 / 41 Branchbran 60.0% 6 / 10 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 42.8% 6 / 14 Podpod 90.0% 9 / 10 totaltotal 70.6% 53 / 75 CC 6 SCAR 11.1
CC
6
Cov
75%
new
6.1
as_string
2.0
suffix
2.0
CRAP 3.0
« lib/Net/NBName/NameQuery.pm ↑ Summary lib/Net/NBName/NodeStatus.pm »
1 2 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
2 2 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
3
4 package Net::NBName::NodeStatus::RR;
5
6 2 ▶use vars '$VERSION';
Subroutine BEGIN: called CC=1 SCAR=0.0
7 2 $VERSION = "0.26";
8
9 2 ▶use vars '@nodetypes';
Subroutine BEGIN: called CC=1 SCAR=0.0
10 2 @nodetypes = qw/B-node P-node M-node H-node/;
11
12 sub new
13 10 ▶{
Subroutine new: called CC=6 SCAR=18.1
Pod undocumented
14 10 my $class = shift;
15 10 my $rr_data = shift;
16 10 my ($name, $suffix, $flags) = unpack("a15Cn", $rr_data);
17 10 $name =~ tr/\x00-\x19/\./; # replace ctrl chars with "."
18 10 $name =~ s/\s+//g;
19
20 10 my $self = {};
21 10 $self->{'name'} = $name;
22 10 $self->{'suffix'} = $suffix;
23 10 ▶ $self->{'G'} = ($flags & 2**15) ? "GROUP" : "UNIQUE";
Branch: 1 branch
BranchTrueFalseTotal
$flags & 32768 ? : 4 6 10
24 10 $self->{'ONT'} = $nodetypes[($flags >> 13) & 3];
25 10 ▶ $self->{'DRG'} = ($flags & 2**12) ? "Deregistering" : "Registered";
Branch: 1 branch
BranchTrueFalseTotal
$flags & 4096 ? : 0 10 10
26 10 ▶ $self->{'CNF'} = ($flags & 2**11) ? "Conflict" : "";
Branch: 1 branch
BranchTrueFalseTotal
$flags & 2048 ? : 0 10 10
27 10 ▶ $self->{'ACT'} = ($flags & 2**10) ? "Active" : "Inactive";
Branch: 1 branch
BranchTrueFalseTotal
$flags & 1024 ? : 10 0 10
28 10 ▶ $self->{'PRM'} = ($flags & 2**9) ? "Permanent" : "";
Branch: 1 branch
BranchTrueFalseTotal
$flags & 512 ? : 0 10 10
29
30 10 bless $self, $class;
31 10 return $self;
32 }
33
34 sub as_string
35 0 ▶{
Subroutine as_string: not called CC=1 SCAR=6.9
Pod documented
36 0 my $self = shift;
37
38 return sprintf "%-15s<%02X> %-6s %-6s %-10s %-8s %-8s %-4s\n",
39 $self->{'name'},
40 $self->{'suffix'},
41 $self->{'G'},
42 $self->{'ONT'},
43 $self->{'DRG'},
44 $self->{'ACT'},
45 $self->{'CNF'},
46 0 $self->{'PRM'};
47 }
48
49 10 ▶sub name { return $_[0]->{'name'}; }
Subroutine name: called CC=1 SCAR=0.0
Pod documented
50 0 ▶sub suffix { return $_[0]->{'suffix'}; }
Subroutine suffix: not called CC=1 SCAR=6.9
Pod documented
51 0 ▶sub G { return $_[0]->{'G'}; }
Subroutine G: not called CC=1 SCAR=6.9
Pod documented
52 0 ▶sub ONT { return $_[0]->{'ONT'}; }
Subroutine ONT: not called CC=1 SCAR=6.9
Pod documented
53 0 ▶sub DRG { return $_[0]->{'DRG'}; }
Subroutine DRG: not called CC=1 SCAR=6.9
Pod documented
54 0 ▶sub ACT { return $_[0]->{'ACT'}; }
Subroutine ACT: not called CC=1 SCAR=6.9
Pod documented
55 0 ▶sub CNF { return $_[0]->{'CNF'}; }
Subroutine CNF: not called CC=1 SCAR=6.9
Pod documented
56 0 ▶sub PRM { return $_[0]->{'PRM'}; }
Subroutine PRM: not called CC=1 SCAR=6.9
Pod documented
57
58 2 1;
59
60 __END__
« lib/Net/NBName/NameQuery.pm ↑ Summary lib/Net/NBName/NodeStatus.pm »