Gnumeric/Base.pm

filter: Statementstmt 100% 26 / 26 Branchbran 83.3% 5 / 6 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 7 / 7 Podpod 100% 2 / 2 totaltotal 97.5% 40 / 41 CC 5 SCAR 6.5
CC
5
Cov
97%
new
3.0
define_instance_accessors
2.0
__ANON__
2.0
CRAP 1.9
« ReadGnumeric.pm ↑ Summary Gnumeric/StyleRegion.pm »
1 # -*- mode: perl; -*-
2 #
3 # Base object for the Gnumeric spreadsheet reader.
4 #
5 # Documentation below "__END__".
6 #
7 # [created. -- rgr, 6-Feb-23.]
8 #
9  
10 package Spreadsheet::Gnumeric::Base;
11  
12 4 ▶use 5.010;
Subroutine BEGIN: called CC=1 SCAR=0.0
13  
14 4 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
15 4 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
16  
17 4 our $VERSION = '0.2';
18  
19 8 ▶sub define_instance_accessors {
Subroutine define_instance_accessors: called CC=2 SCAR=6.9
Pod documented
20 8 my ($class, @accessors) = @_;
21  
22 4 ▶ no strict 'refs';
Subroutine BEGIN: called CC=1 SCAR=0.0
23 8 for my $method (@accessors) {
24 88 my $field = '_' . $method;
25 88 ▶ *{$class . '::' . $method} = sub {
Subroutine __ANON__: called CC=2 SCAR=6.9
26 162823 my $self = shift;
27 162823 ▶ @_ ? $self->{$field} = shift : $self->{$field};
Branch: 1 branch
BranchTrueFalseTotal
@_ ? : 59851 102972 162823
28 88 };
29 }
30 }
31  
32 121 ▶sub new {
Subroutine new: called CC=3 SCAR=11.0
Pod documented
33 121 my ($class, @options) = @_;
34  
35 121 my $self = bless({ }, $class);
36 121 ▶ while (@options) {
Branch: 1 branch
BranchTrueFalseTotal
if (@options) 559 121 680
37 559 my ($slot, $value) = (shift(@options), shift(@options));
38 559 ▶ $self->$slot($value)
Branch: 1 branch
BranchTrueFalseTotal
if $self->can($slot) 559 0 559
39 if $self->can($slot);
40 }
41 121 return $self;
42 }
43  
44 4 1;
45  
46 __END__
« ReadGnumeric.pm ↑ Summary Gnumeric/StyleRegion.pm »