HeaderPar.pm

filter: Statementstmt 100% 44 / 44 Branchbran 87.5% 7 / 8 Conditioncond 66.6% 4 / 6 MC/DCmcdc 0.0% 0 / 4 Subroutinesub 100% 12 / 12 Podpod 100% 3 / 3 totaltotal 90.9% 70 / 77 CC 7 SCAR 7.0
CC
7
Cov
95%
new
4.1
name
2.0
__ANON__
2.0
CRAP 2.0
« HeaderPars.pm ↑ Summary Constants.pm »
1 package Astro::STSDAS::Table::HeaderPar;
2  
3 4 require 5.005_62;
4 4 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 4 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
6  
7 4 ▶use Carp;
Subroutine BEGIN: called CC=1 SCAR=0.0
8  
9 4 our $VERSION = '0.01';
10  
11 4 ▶use Astro::STSDAS::Table::Constants;
Subroutine BEGIN: called CC=1 SCAR=0.0
12  
13 4 our @hdrkeys = qw( idx name value comment type );
14  
15  
16 sub new
17 5 ▶{
Subroutine new: called CC=4 SCAR=14.1
Pod documented
18 5 my $class = shift;
19 5 ▶ $class = ref($class) || $class;
Condition66%2/3
ref $class || $class
l!l&&r!l&&!r
140
MC/DC0%0/2
ref $class || $class
ref $class $class
Truth table66%2/3
A || B
A= ref $classB= $class
ABresult
1X1
011
000
20
21 5 my $self = bless {}, $class;
22
23 5 @{$self}{@hdrkeys} = @_;
24  
25 5 $self->{name} = uc $self->{name};
26
27 croak( __PACKAGE__, '->new: illegal header type' )
28 5 ▶ if defined $self->{type} && ! exists $Types{$self->{type}};
Branch: 1 branch
BranchTrueFalseTotal
if defined $self->{"type"} and not exists $Astro::STSDAS::Table::HeaderPar::Types{$self->{"type"}} 0 5 5
Condition66%2/3
defined $self->{"type"} and not exists $Astro::STSDAS::Table::HeaderPar::Types{$self->{"type"}}
!ll&&!rl&&r
320
MC/DC0%0/2
defined $self->{"type"} and not exists $Astro::STSDAS::Table::HeaderPar::Types{$self->{"type"}}
defined $self->{"type"} not exists $Astro::STSDAS::Table::HeaderPar::Types{$self->{"type"}}
Truth table66%2/3
A and not(B)
A= defined $self->{"type"}B= not exists $Astro::STSDAS::Table::HeaderPar::Types{$self->{"type"}}
ABresult
0X0
100
111
29  
30 5 $self;
31 }
32  
33 sub name
34 11 ▶{
Subroutine name: called CC=2 SCAR=6.9
Pod documented
35 11 my $self = shift;
36 11 ▶ $self->{name} = uc $_[0] if @_;
Branch: 1 branch
BranchTrueFalseTotal
if @_ 2 9 11
37 11 $self->{name};
38 }
39  
40 sub _access_rw
41 12 ▶{
Subroutine _access_rw: called CC=1 SCAR=0.0
42 12 my $what = shift;
43
44 5 ▶ sub {
Subroutine __ANON__: called CC=2 SCAR=6.9
45 5 my $self = shift;
46 5 ▶ $self->{$what} = $_[0] if @_;
Branch: 1 branch
BranchTrueFalseTotal
if @_ 2 3 5
47 5 $self->{$what};
48 }
49 12 }
50  
51 sub _access_ro
52 4 ▶{
Subroutine _access_ro: called CC=1 SCAR=0.0
53 4 my $what = shift;
54 6 ▶ sub { croak( __PACKAGE__, "->$what: attempt to write to RO attribute" )
Subroutine __ANON__: called CC=2 SCAR=6.9
Branch: 1 branch
BranchTrueFalseTotal
if @_ > 1 1 5 6
55 if @_ > 1;
56 5 $_[0]->{$what}
57 }
58 4 }
59  
60  
61 {
62 4 ▶ no strict 'refs';
Subroutine BEGIN: called CC=1 SCAR=0.0
63 4 *$_ = _access_rw( $_ ) foreach qw( value comment type );
64
65 4 *$_ = _access_ro( $_ ) foreach qw( idx );
66 }
67  
68 sub copy
69 1 ▶{
Subroutine copy: called CC=1 SCAR=0.0
Pod documented
70 1 $_[0]->new( @{$_[0]}{@hdrkeys} );
71 }
72  
73  
74 4 1;
75 __END__
« HeaderPars.pm ↑ Summary Constants.pm »