lib/Biblio/ILL/ISO/SEQUENCE_OF.pm

filter: Statementstmt 72.7% 32 / 44 Branchbran 75.0% 3 / 4 Conditioncond 33.3% 1 / 3 MC/DCmcdc 0.0% 0 / 2 Subroutinesub 77.7% 7 / 9 Podpod 100% 6 / 6 totaltotal 72.0% 49 / 68 CC 7 SCAR 11.9
CC
7
Cov
71%
as_string
6.0
as_pretty_string
6.0
new
4.1
CRAP 3.3
« lib/Biblio/ILL/ISO/ISOTime.pm ↑ Summary lib/Biblio/ILL/ISO/ConditionalResultsCondition.pm »
1 package Biblio::ILL::ISO::SEQUENCE_OF;
2  
3 =head1 NAME
4  
5 Biblio::ILL::ISO::SEQUENCE_OF
6  
7 =cut
8  
9 4 ▶use Biblio::ILL::ISO::ILLASNtype;
Subroutine BEGIN: called CC=1 SCAR=0.0
10  
11 4 ▶use Carp;
Subroutine BEGIN: called CC=1 SCAR=0.0
12  
13 =head1 VERSION
14  
15 Version 0.01
16  
17 =cut
18  
19 4 our $VERSION = '0.01';
20 #---------------------------------------------------------------------------
21 # Mods
22 # 0.01 - 2003.07.15 - original version
23 #---------------------------------------------------------------------------
24  
25 =head1 DESCRIPTION
26  
27 Biblio::ILL::ISO::SEQUENCE_OF is a derivation of Biblio::ILL::ISO::ILLASNtype.
28 It functions as a base class for any class that needs to handle sequence types.
29  
30 =head1 USES
31  
32 None.
33  
34 =head1 USED IN
35  
36 Biblio::ILL::ISO::AlreadyTriedListType
37 Biblio::ILL::ISO::ElectronicDeliveryServiceSequence
38 Biblio::ILL::ISO::ILLServiceTypeSequence
39 Biblio::ILL::ISO::LocationInfoSequence
40 Biblio::ILL::ISO::SendToListTypeSequence
41 Biblio::ILL::ISO::SupplyMediumInfoTypeSequence
42 Biblio::ILL::ISO::UnitsPerMediumTypeSequence
43  
44 =cut
45  
46 4 ▶BEGIN{@ISA = qw ( Biblio::ILL::ISO::ILLASNtype );} # inherit from ILLASNtype
Subroutine BEGIN: called CC=1 SCAR=0.0
47  
48 =head1 FROM THE ASN DEFINITION
49  
50 There is no ASN DEFINITION for SEQUENCE_OF. An ASN.1 element can be defined
51 as a SEQUENCE OF another element - it is simply a list.
52  
53 =cut
54  
55 #---------------------------------------------------------------
56 #
57 #---------------------------------------------------------------
58 =head1
59  
60 =head2 new( [ @objrefs ] )
61  
62 Creates a new SEQUENCE_OF object.
63 Expects either no paramaters, or a list of objects to be added to the list.
64  
65 =cut
66 14 ▶sub new {
Subroutine new: called CC=4 SCAR=14.1
Pod documented
67 14 my $class = shift;
68 14 my $self = {};
69  
70 14 $self->{"SEQUENCE"} = [ ];
71  
72 14 ▶ if (@_) {
Branch: 1 branch
BranchTrueFalseTotal
if (@_) 14 0 14
73 14 ▶ while ($objref = shift) {
Branch: 1 branch
BranchTrueFalseTotal
if ($objref = shift()) 16 14 30
74 16 push @{ $self->{"SEQUENCE"} }, $objref;
75 }
76 }
77 14 ▶ bless($self, ref($class) || $class);
Condition33%1/3
ref $class || $class
l!l&&r!l&&!r
0140
MC/DC0%0/2
ref $class || $class
ref $class $class
Truth table33%1/3
A || B
A= ref $classB= $class
ABresult
1X1
011
000
78 14 return ($self);
79 }
80  
81  
82 #---------------------------------------------------------------
83 #
84 #---------------------------------------------------------------
85 =head1
86  
87 =head2 as_string( )
88  
89 Returns a stringified representation of the object.
90  
91 =cut
92 0 ▶sub as_string {
Subroutine as_string: not called CC=2 SCAR=17.9
Pod documented
93 0 my $self = shift;
94  
95 0 my $s = "SEQUENCE\n";
96 0 foreach $elem (@{ $self->{"SEQUENCE"} }) {
97 0 $s .= $elem->as_string();
98 }
99 0 return $s;
100 }
101  
102  
103 #---------------------------------------------------------------
104 #
105 #---------------------------------------------------------------
106 =head1
107  
108 =head2 as_pretty_string( )
109  
110 Returns a more-formatted stringified representation of the object.
111  
112 =cut
113 0 ▶sub as_pretty_string {
Subroutine as_pretty_string: not called CC=2 SCAR=17.9
Pod documented
114 0 my $self = shift;
115  
116 0 my $s = "SEQUENCE\n";
117 0 foreach $elem (@{ $self->{"SEQUENCE"} }) {
118 0 $s .= "\n" . $elem->as_pretty_string();
119 }
120 0 return $s;
121 }
122  
123  
124 #---------------------------------------------------------------
125 # This will return a structure usable by Convert::ASN1
126 #---------------------------------------------------------------
127 =head1
128  
129 =head2 as_asn( )
130  
131 Returns a structure usable by Convert::ASN1. Generally only called
132 from the parent's as_asn() method (or encode() method for top-level
133 message-type objects).
134  
135 =cut
136 8 ▶sub as_asn {
Subroutine as_asn: called CC=2 SCAR=6.9
Pod documented
137 8 my $self = shift;
138  
139 #print "Constructing array for SEQUENCE OF " . ref( $self->{"SEQUENCE"}[0] ) . "\n";
140  
141 8 my @a = ();
142  
143 8 foreach my $elem ( @{ $self->{"SEQUENCE"} }) {
144 #print " pushing " . ref($elem) . "\n";
145 19 push @a, $elem->as_asn();
146 }
147 8 return \@a;
148 }
149  
150 #---------------------------------------------------------------
151 #
152 #---------------------------------------------------------------
153 =head1
154  
155 =head2 add( $objref )
156  
157 Adds an element to the list.
158 Expects an object (presumably of the correct type - does no error checking!)
159  
160 =cut
161 17 ▶sub add {
Subroutine add: called CC=1 SCAR=0.0
Pod documented
162 17 my $self = shift;
163 17 my ($objref) = @_;
164  
165 17 push @{ $self->{"SEQUENCE"} }, $objref;
166 17 return;
167 }
168  
169 #---------------------------------------------------------------
170 #
171 #---------------------------------------------------------------
172 =head1
173  
174 =head2 count()
175  
176 Returns a count of the elements in the list.
177  
178 =cut
179 2 ▶sub count {
Subroutine count: called CC=1 SCAR=0.0
Pod documented
180 2 my $self = shift;
181  
182 2 return scalar( @{ $self->{"SEQUENCE"} });
183 }
184  
185 =head1 SEE ALSO
186  
187 See the README for system design notes.
188 See the parent class(es) for other available methods.
189 See the derived classes for examples of use.
190  
191 For more information on Interlibrary Loan standards (ISO 10160/10161),
192 a good place to start is:
193  
194 http://www.nlc-bnc.ca/iso/ill/main.htm
195  
196 =cut
197  
198 =head1 AUTHOR
199  
200 David Christensen, <DChristensenSPAMLESS@westman.wave.ca>
201  
202 =cut
203  
204  
205 =head1 COPYRIGHT AND LICENSE
206  
207 Copyright 2003 by David Christensen
208  
209 This library is free software; you can redistribute it and/or modify it
210 under the same terms as Perl itself.
211  
212 =cut
213  
214 4 1;
« lib/Biblio/ILL/ISO/ISOTime.pm ↑ Summary lib/Biblio/ILL/ISO/ConditionalResultsCondition.pm »