lib/Biblio/ILL/ISO/ISOTime.pm

filter: Statementstmt 71.8% 23 / 32 Branchbran 30.0% 3 / 10 Conditioncond 33.3% 1 / 3 MC/DCmcdc 0.0% 0 / 2 Subroutinesub 66.6% 6 / 9 Podpod 80.0% 4 / 5 totaltotal 60.6% 37 / 61 CC 7 SCAR 15.8
CC
7
Cov
60%
set
12.0
new
5.5
as_string
2.0
CRAP 4.8
« lib/Biblio/ILL/ISO/ISODate.pm ↑ Summary lib/Biblio/ILL/ISO/SEQUENCE_OF.pm »
1 package Biblio::ILL::ISO::ISOTime;
2  
3 =head1 NAME
4  
5 Biblio::ILL::ISO::ISOTime
6  
7 =cut
8  
9 4 ▶use Biblio::ILL::ISO::ILLASNtype;
Subroutine BEGIN: called CC=1 SCAR=0.0
10 4 ▶use Biblio::ILL::ISO::ILLString;
Subroutine BEGIN: called CC=1 SCAR=0.0
11  
12 4 ▶use Carp;
Subroutine BEGIN: called CC=1 SCAR=0.0
13  
14 =head1 VERSION
15  
16 Version 0.01
17  
18 =cut
19  
20 4 our $VERSION = '0.01';
21 #---------------------------------------------------------------------------
22 # Mods
23 # 0.01 - 2003.07.15 - original version
24 #---------------------------------------------------------------------------
25  
26 =head1 DESCRIPTION
27  
28 Biblio::ILL::ISO::ISOTime is a derivation of Biblio::ILL::ISO::ILLASNtype.
29  
30 =head1 USES
31  
32 Biblio::ILL::ISO::ILLString
33  
34 =head1 USED IN
35  
36 Biblio::ILL::ISO::DateTime
37 Biblio::ILL::ISO::ElectronicDeliveryService
38  
39 =cut
40  
41 4 ▶BEGIN{@ISA = qw ( Biblio::ILL::ISO::ILLString
Subroutine BEGIN: called CC=1 SCAR=0.0
42 Biblio::ILL::ISO::ILLASNtype );} # inherit from ILLASNtype
43  
44 =head1 FROM THE ASN DEFINITION
45
46 ISO-Time ::= VisibleString
47 -- conforms to ISO 8601
48 -- length = 6,
49 -- fixed
50 -- HHMMSS
51 -- local time of person or institution invoking service
52  
53 =cut
54  
55 #
56 # NOTE that an ISO-Time _is_not_ an ILL-String!
57 # ...but I've already got ILLString built, so we'll just
58 # inherit and tweak...
59 #
60  
61 =head1 METHODS
62  
63 =cut
64  
65 #---------------------------------------------------------------
66 #
67 #---------------------------------------------------------------
68 =head1
69  
70 =head2 new( $timestring )
71  
72 Creates a new ISODate object.
73 Expects a properly formatted time string (HHMMSS).
74  
75 =cut
76 44 ▶sub new {
Subroutine new: called CC=5 SCAR=17.1
Pod documented
77 44 my $class = shift;
78 44 my $self = {};
79  
80 44 ▶ bless($self, ref($class) || $class);
Condition33%1/3
ref $class || $class
l!l&&r!l&&!r
0440
MC/DC0%0/2
ref $class || $class
ref $class $class
Truth table33%1/3
A || B
A= ref $classB= $class
ABresult
1X1
011
000
81 44 ▶ if (@_) {
Branch: 1 branch
BranchTrueFalseTotal
if (@_) 44 0 44
82 44 my $s = shift;
83
84 # could use more error checking
85 44 ▶ croak "Invalid ISOTime length: [$s]" if ((length $s) > 6);
Branch: 1 branch
BranchTrueFalseTotal
if length $s > 6 0 44 44
86 44 ▶ croak "Invalid ISOTime: [$s]" if ($s =~ /\D/);
Branch: 1 branch
BranchTrueFalseTotal
if $s =~ /\D/ 0 44 44
87 44 $self->SUPER::set($s); #invoke parent (ie ILLString) 'set'
88 }
89  
90 44 return ($self);
91 }
92  
93  
94 #---------------------------------------------------------------
95 #
96 #---------------------------------------------------------------
97 =head1
98  
99 =head2 new( $timestring )
100  
101 Sets the object's value.
102 Expects a properly formatted time string (HHMMSS).
103  
104 =cut
105 0 ▶sub set {
Subroutine set: not called CC=3 SCAR=24.8
Pod undocumented
106 0 my $self = shift;
107 0 my $s = shift;
108
109 # could use more error checking
110 0 ▶ croak "Invalid ISOTime length: [$s]" if ((length $s) > 6);
Branch: 1 branch
BranchTrueFalseTotal
if length $s > 6 0 0 0
111 0 ▶ croak "Invalid ISOTime: [$s]" if ($s =~ /\D/);
Branch: 1 branch
BranchTrueFalseTotal
if $s =~ /\D/ 0 0 0
112 0 $self->SUPER::set($s); #invoke parent (ie ILLString) 'set'
113 }
114  
115  
116 #---------------------------------------------------------------
117 #
118 #---------------------------------------------------------------
119 =head1
120  
121 =head2 as_string( )
122  
123 Returns a stringified representation of the object.
124  
125 =cut
126 0 ▶sub as_string {
Subroutine as_string: not called CC=1 SCAR=6.9
Pod documented
127 0 my $self = shift;
128  
129 0 return $self->{"generalstring"};
130 }
131  
132  
133 #---------------------------------------------------------------
134 #
135 #---------------------------------------------------------------
136 =head1
137  
138 =head2 as_pretty_string( )
139  
140 Returns a more-formatted stringified representation of the object.
141  
142 =cut
143 0 ▶sub as_pretty_string {
Subroutine as_pretty_string: not called CC=1 SCAR=6.9
Pod documented
144 0 my $self = shift;
145  
146 0 return $self->{"generalstring"};
147 }
148  
149 #---------------------------------------------------------------
150 # This will return a structure usable by Convert::ASN1
151 #---------------------------------------------------------------
152 =head1
153  
154 =head2 as_asn( )
155  
156 Returns a structure usable by Convert::ASN1. Generally only called
157 from the parent's as_asn() method (or encode() method for top-level
158 message-type objects).
159  
160 =cut
161 40 ▶sub as_asn {
Subroutine as_asn: called CC=1 SCAR=0.0
Pod documented
162 40 my $self = shift;
163  
164 # DC - debug
165 #print " " . $self->{"generalstring"} . "\n";
166  
167 40 return $self->{"generalstring"};
168 }
169  
170 =head1 SEE ALSO
171  
172 See the README for system design notes.
173 See the parent class(es) for other available methods.
174  
175 For more information on Interlibrary Loan standards (ISO 10160/10161),
176 a good place to start is:
177  
178 http://www.nlc-bnc.ca/iso/ill/main.htm
179  
180 =cut
181  
182 =head1 AUTHOR
183  
184 David Christensen, <DChristensenSPAMLESS@westman.wave.ca>
185  
186 =cut
187  
188  
189 =head1 COPYRIGHT AND LICENSE
190  
191 Copyright 2003 by David Christensen
192  
193 This library is free software; you can redistribute it and/or modify it
194 under the same terms as Perl itself.
195  
196 =cut
197  
198 4 1;
« lib/Biblio/ILL/ISO/ISODate.pm ↑ Summary lib/Biblio/ILL/ISO/SEQUENCE_OF.pm »