lib/SIRTX/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
« blib/lib/SIRTX/VM/Register.pm ↑ Summary blib/lib/SIRTX/VM.pm »
1 # Copyright (c) 2024-2025 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.12;
19  
20 use constant {
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 ▶};
Subroutine BEGIN: called CC=1 SCAR=0.0
32  
33  
34 sub physical {
35 0 ▶ my ($self) = @_;
Subroutine physical: not called CC=1 SCAR=6.9
Pod documented
36 0 return $self->{physical};
37 }
38  
39  
40 sub name {
41 0 ▶ my ($self) = @_;
Subroutine name: not called CC=1 SCAR=6.9
Pod documented
42 0 return $self->{name};
43 }
44  
45  
46 sub owner {
47 0 ▶ my ($self, $n) = @_;
Subroutine owner: not called CC=2 SCAR=17.9
Pod documented
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 sub temperature {
54 0 ▶ my ($self, $n) = @_;
Subroutine temperature: not called CC=2 SCAR=17.9
Pod documented
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 sub clone {
61 0 ▶ my ($self) = @_;
Subroutine clone: not called CC=1 SCAR=6.9
Pod documented
62 0 return __PACKAGE__->_new(%{$self});
63 }
64  
65 # ---- Private helpers ----
66  
67 sub _new {
68 0 ▶ my ($pkg, %opts) = @_;
Subroutine _new: not called CC=1 SCAR=6.9
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__
« blib/lib/SIRTX/VM/Register.pm ↑ Summary blib/lib/SIRTX/VM.pm »