VM/Register.pm

filter: Statementstmt 55.8% 19 / 34 Branchbran 0.0% 0 / 4 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 50.0% 6 / 12 Podpod 100% 5 / 5 totaltotal 54.5% 30 / 55 CC 3 SCAR 10.0
CC
3
Cov
50%
owner
6.0
temperature
6.0
physical
2.0
CRAP 2.7
« VM/RegisterFile.pm ↑ Summary VM.pm »
1 # Copyright (c) 2024-2026 Philipp Schafft
2  
3 # licensed under Artistic License 2.0 (see LICENSE file)
4  
5 # ABSTRACT: module for interacting with SIRTX VM code
6  
7  
8 package SIRTX::VM::Register;
9  
10 1 ▶use v5.16;
Subroutine BEGIN: called CC=1 SCAR=0.0
11 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
12 1 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
13  
14 1 ▶use Carp;
Subroutine BEGIN: called CC=1 SCAR=0.0
15  
16 1 ▶use parent 'Data::Identifier::Interface::Userdata';
Subroutine BEGIN: called CC=1 SCAR=0.0
17  
18 1 our $VERSION = v0.13;
19  
20 1 ▶use constant {
Subroutine BEGIN: called CC=1 SCAR=0.0
21 1 TYPE_USER => 'user',
22 TYPE_SYSTEM => 'system',
23  
24 OWNER_MINE => 'mine',
25 OWNER_YOURS => 'yours',
26 OWNER_THEIRS => 'theirs',
27  
28 TEMPERATURE_HOT => 'hot',
29 TEMPERATURE_COLD => 'cold',
30 TEMPERATURE_LUKEWARM => 'lukewarm',
31 1 };
32  
33  
34 0 ▶sub physical {
Subroutine physical: not called CC=1 SCAR=6.9
Pod documented
35 0 my ($self) = @_;
36 0 return $self->{physical};
37 }
38  
39  
40 0 ▶sub name {
Subroutine name: not called CC=1 SCAR=6.9
Pod documented
41 0 my ($self) = @_;
42 0 return $self->{name};
43 }
44  
45  
46 0 ▶sub owner {
Subroutine owner: not called CC=2 SCAR=17.9
Pod documented
47 0 my ($self, $n) = @_;
48 0 ▶ $self->{owner} = $n if defined $n;
Branch: 1 branch
BranchTrueFalseTotal
if defined $n 0 0 0
49 0 return $self->{owner};
50 }
51  
52  
53 0 ▶sub temperature {
Subroutine temperature: not called CC=2 SCAR=17.9
Pod documented
54 0 my ($self, $n) = @_;
55 0 ▶ $self->{temperature} = $n if defined $n;
Branch: 1 branch
BranchTrueFalseTotal
if defined $n 0 0 0
56 0 return $self->{temperature};
57 }
58  
59  
60 0 ▶sub clone {
Subroutine clone: not called CC=1 SCAR=6.9
Pod documented
61 0 my ($self) = @_;
62 0 return __PACKAGE__->_new(%{$self});
63 }
64  
65 # ---- Private helpers ----
66  
67 0 ▶sub _new {
Subroutine _new: not called CC=1 SCAR=6.9
68 0 my ($pkg, %opts) = @_;
69 0 my $self = bless {
70 owner => OWNER_MINE,
71 temperature => TEMPERATURE_LUKEWARM,
72 %opts,
73 }, $pkg;
74 }
75  
76 # ---- Docs for constants ----
77  
78  
79 1 1;
80  
81 __END__
« VM/RegisterFile.pm ↑ Summary VM.pm »