lib/Biblio/ILL/ISO/ILLString.pm

filter: Statementstmt 50.0% 19 / 38 Branchbran 12.5% 1 / 8 Conditioncond 16.6% 1 / 6 MC/DCmcdc 0.0% 0 / 4 Subroutinesub 55.5% 5 / 9 Podpod 0.0% 0 / 6 totaltotal 36.6% 26 / 71 CC 8 SCAR 21.2
CC
8
Cov
40%
from_asn
20.0
as_string
12.0
new
3.2
CRAP 8.3
« lib/Biblio/ILL/ISO/DateTime.pm ↑ Summary lib/Biblio/ILL/ISO/PersonOrInstitutionSymbol.pm »
1 package Biblio::ILL::ISO::ILLString;
2  
3 4 ▶use Biblio::ILL::ISO::ILLASNtype;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 4 ▶use Carp;
Subroutine BEGIN: called CC=1 SCAR=0.0
5  
6 4 our $VERSION = '0.01';
7 #---------------------------------------------------------------------------
8 # Mods
9 # 0.01 - 2003.07.15 - original version
10 #---------------------------------------------------------------------------
11  
12 4 ▶BEGIN{@ISA = qw ( Biblio::ILL::ISO::ILLASNtype );} # inherit from ILLASNtype
Subroutine BEGIN: called CC=1 SCAR=0.0
13  
14 # From the ASN
15 #
16 #ILL-String ::= CHOICE {
17 # generalstring GeneralString,
18 # -- may contain any ISO registered G (graphic) and C
19 # -- (control) character set
20 # edifactstring EDIFACTString
21 # }
22 # -- may not include leading or trailing spaces
23 # -- may not consist only of space (" ") or non-printing
24 # -- characters
25  
26  
27 #---------------------------------------------------------------
28 #
29 #---------------------------------------------------------------
30 269 ▶sub new {
Subroutine new: called CC=3 SCAR=11.6
Pod undocumented
31 269 my $class = shift;
32 269 my $self = {};
33  
34 269 ▶ if (@_) {
Branch: 1 branch
BranchTrueFalseTotal
if (@_) 269 0 269
35 269 $self->{"generalstring"} = shift;
36 }
37 269 ▶ bless($self, ref($class) || $class);
Condition33%1/3
ref $class || $class
l!l&&r!l&&!r
02690
MC/DC0%0/2
ref $class || $class
ref $class $class
Truth table33%1/3
A || B
A= ref $classB= $class
ABresult
1X1
011
000
38 269 return ($self);
39 }
40  
41 #---------------------------------------------------------------
42 #
43 #---------------------------------------------------------------
44 111 ▶sub set {
Subroutine set: called CC=1 SCAR=0.0
Pod undocumented
45 111 my $self = shift;
46 111 my ($s) = @_;
47  
48 111 $self->{generalstring} = $s;
49 111 return;
50 }
51  
52  
53 #---------------------------------------------------------------
54 #
55 #---------------------------------------------------------------
56 0 ▶sub set_general {
Subroutine set_general: not called CC=1 SCAR=6.9
Pod undocumented
57 0 my $self = shift;
58 0 my ($s) = @_;
59  
60 0 $self->{generalstring} = $s;
61 0 return;
62 }
63  
64  
65 #---------------------------------------------------------------
66 #
67 #---------------------------------------------------------------
68 0 ▶sub set_edifact {
Subroutine set_edifact: not called CC=1 SCAR=6.9
Pod undocumented
69 0 my $self = shift;
70 0 my ($s) = @_;
71  
72 0 $self->{EDIFACTstring} = $s;
73 0 return;
74 }
75  
76  
77 #---------------------------------------------------------------
78 #
79 #---------------------------------------------------------------
80 0 ▶sub as_string {
Subroutine as_string: not called CC=3 SCAR=24.8
Pod undocumented
81 0 my $self = shift;
82  
83 0 ▶ return $self->{generalstring} if ($self->{generalstring});
Branch: 1 branch
BranchTrueFalseTotal
if $self->{"generalstring"} 0 0 0
84 0 ▶ return $self->{EDIFACTstring} if ($self->{EDIFACTstring});
Branch: 1 branch
BranchTrueFalseTotal
if $self->{"EDIFACTstring"} 0 0 0
85 0 return "";
86 }
87  
88 #---------------------------------------------------------------
89 #
90 #---------------------------------------------------------------
91 0 ▶sub from_asn {
Subroutine from_asn: not called CC=4 SCAR=30.0
Pod undocumented
92 0 my $self = shift;
93 0 my $href = shift;
94  
95 0 foreach my $k (keys %$href) {
96 #print ref($self) . "...$k\n";
97  
98 0 ▶ if (($k =~ /^generalstring$/)
Branch: 1 branch
BranchTrueFalseTotal
if ($k =~ /^generalstring$/ or $k =~ /^edifactstring$/) { } 0 0 0
Condition0%0/3
$k =~ /^generalstring$/ or $k =~ /^edifactstring$/
l!l&&r!l&&!r
000
MC/DC0%0/2
$k =~ /^generalstring$/ or $k =~ /^edifactstring$/
$k =~ /^generalstring$/ $k =~ /^edifactstring$/
Truth table0%0/3
A or B
A= $k =~ /^generalstring$/B= $k =~ /^edifactstring$/
ABresult
1X1
011
000
99 || ($k =~ /^edifactstring$/)
100 ) {
101 #print " $href->{$k}\n";
102 0 $self->{$k} = $href->{$k};
103  
104 } else {
105 0 croak "invalid " . ref($self) . " element: [$k]";
106 }
107  
108 }
109 0 return $self;
110 }
111  
112 4 1;
« lib/Biblio/ILL/ISO/DateTime.pm ↑ Summary lib/Biblio/ILL/ISO/PersonOrInstitutionSymbol.pm »