File Coverage

blib/lib/Spreadsheet/Gnumeric/Base.pm
Criterion Covered Total %
statement 24 24 100.0
branch 3 4 75.0
condition n/a
subroutine 7 7 100.0
pod 2 2 100.0
total 36 37 97.3


line stmt bran cond sub pod time code
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     4   1360 use 5.010;
  4         12  
13              
14 4     4   17 use strict;
  4         7  
  4         62  
15 4     4   14 use warnings;
  4         7  
  4         239  
16              
17             our $VERSION = '0.2';
18              
19             sub define_instance_accessors {
20 8     8 1 29 my ($class, @accessors) = @_;
21              
22 4     4   49 no strict 'refs';
  4         6  
  4         671  
23 8         29 for my $method (@accessors) {
24 88         152 my $field = '_' . $method;
25 88         1099 *{$class . '::' . $method} = sub {
26 162823     162823   190325 my $self = shift;
27 162823 100       403759 @_ ? $self->{$field} = shift : $self->{$field};
28 88         221 };
29             }
30             }
31              
32             sub new {
33 121     121 1 329 my ($class, @options) = @_;
34              
35 121         245 my $self = bless({ }, $class);
36 121         295 while (@options) {
37 559         902 my ($slot, $value) = (shift(@options), shift(@options));
38 559 50       1613 $self->$slot($value)
39             if $self->can($slot);
40             }
41 121         285 return $self;
42             }
43              
44             1;
45              
46             __END__