PJVM/Runtime/Object.pm

filter: Statementstmt 48.1% 13 / 27 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 57.1% 4 / 7 Podpod 0.0% 0 / 3 totaltotal 45.9% 17 / 37 CC 3 SCAR 12.0
CC
3
Cov
48%
new
6.0
clone
6.0
class
2.0
CRAP 3.3
« PJVM/Class/Method.pm ↑ Summary PJVM/Class/Attribute/InnerClasses.pm »
1 package PJVM::Runtime::Object;
2  
3 4 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 4 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
5  
6 4 ▶use Scalar::Util qw(weaken);
Subroutine BEGIN: called CC=1 SCAR=0.0
7  
8 4 ▶use PJVM::Access qw(:flags);
Subroutine BEGIN: called CC=1 SCAR=0.0
9  
10 0 ▶sub new {
Subroutine new: not called CC=2 SCAR=17.9
Pod undocumented
11 0 my ($pkg, $class) = @_;
12 0 my $self = bless { ".class" => $class }, $pkg;
13 0 weaken $self->{".class"};
14 # Set defaults for all fields
15 0 my $fields = $class->instance_fields;
16 0 for my $name (keys %$fields) {
17 0 my $default = PJVM::Types->default_value_for_signature($fields->{$name});
18 0 $self->{$name} = $default;
19 }
20
21 0 return $self;
22 }
23  
24 0 ▶sub class {
Subroutine class: not called CC=1 SCAR=6.9
Pod undocumented
25 0 my $self = shift;
26 0 return $self->{".class"};
27 }
28  
29 0 ▶sub clone {
Subroutine clone: not called CC=2 SCAR=17.9
Pod undocumented
30 0 my $self = shift;
31 0 my $clone = bless {}, $self;
32 0 $clone->{$_} = $self->{$_} for keys %$self;
33 0 return $clone;
34 }
35  
36 4 1;
37 __END__
« PJVM/Class/Method.pm ↑ Summary PJVM/Class/Attribute/InnerClasses.pm »