| 1 | package Biblio::ILL::ISO::ServiceDateTime; | ||||||||||||||||||||||||||||
| 2 | |||||||||||||||||||||||||||||
| 3 | =head1 NAME | ||||||||||||||||||||||||||||
| 4 | |||||||||||||||||||||||||||||
| 5 | Biblio::ILL::ISO::ServiceDateTime | ||||||||||||||||||||||||||||
| 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::DateTime; | ||||||||||||||||||||||||||
|
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::ServiceDateTime is a derivation of Biblio::ILL::ISO::ILLASNtype. | ||||||||||||||||||||||||||||
| 29 | |||||||||||||||||||||||||||||
| 30 | =head1 USES | ||||||||||||||||||||||||||||
| 31 | |||||||||||||||||||||||||||||
| 32 | Biblio::ILL::ISO::DateTime | ||||||||||||||||||||||||||||
| 33 | |||||||||||||||||||||||||||||
| 34 | =head1 USED IN | ||||||||||||||||||||||||||||
| 35 | |||||||||||||||||||||||||||||
| 36 | Biblio::ILL::ISO::Answer | ||||||||||||||||||||||||||||
| 37 | Biblio::ILL::ISO::Cancel | ||||||||||||||||||||||||||||
| 38 | Biblio::ILL::ISO::CancelReply | ||||||||||||||||||||||||||||
| 39 | Biblio::ILL::ISO::CheckedIn | ||||||||||||||||||||||||||||
| 40 | Biblio::ILL::ISO::Damaged | ||||||||||||||||||||||||||||
| 41 | Biblio::ILL::ISO::Expired | ||||||||||||||||||||||||||||
| 42 | Biblio::ILL::ISO::ForwardNotification | ||||||||||||||||||||||||||||
| 43 | Biblio::ILL::ISO::Lost | ||||||||||||||||||||||||||||
| 44 | Biblio::ILL::ISO::Message | ||||||||||||||||||||||||||||
| 45 | Biblio::ILL::ISO::Overdue | ||||||||||||||||||||||||||||
| 46 | Biblio::ILL::ISO::Recall | ||||||||||||||||||||||||||||
| 47 | Biblio::ILL::ISO::Received | ||||||||||||||||||||||||||||
| 48 | Biblio::ILL::ISO::RenewAnswer | ||||||||||||||||||||||||||||
| 49 | Biblio::ILL::ISO::Renew | ||||||||||||||||||||||||||||
| 50 | Biblio::ILL::ISO::Request | ||||||||||||||||||||||||||||
| 51 | Biblio::ILL::ISO::Returned | ||||||||||||||||||||||||||||
| 52 | Biblio::ILL::ISO::Shipped | ||||||||||||||||||||||||||||
| 53 | Biblio::ILL::ISO::StatusOrErrorReport | ||||||||||||||||||||||||||||
| 54 | Biblio::ILL::ISO::StatusQuery | ||||||||||||||||||||||||||||
| 55 | |||||||||||||||||||||||||||||
| 56 | =cut | ||||||||||||||||||||||||||||
| 57 | |||||||||||||||||||||||||||||
| 58 | 4 | ▶ | BEGIN{@ISA = qw ( Biblio::ILL::ISO::ILLASNtype );} # inherit from ILLASNtype | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 59 | |||||||||||||||||||||||||||||
| 60 | =head1 FROM THE ASN DEFINITION | ||||||||||||||||||||||||||||
| 61 | |||||||||||||||||||||||||||||
| 62 | Service-Date-Time ::= SEQUENCE { | ||||||||||||||||||||||||||||
| 63 | date-time-of-this-service [0] IMPLICIT Date-Time, | ||||||||||||||||||||||||||||
| 64 | -- Time is mandatory for 2nd and subsequent services | ||||||||||||||||||||||||||||
| 65 | -- invoked for a given ILL-transaction on the same day | ||||||||||||||||||||||||||||
| 66 | date-time-of-original-service [1] IMPLICIT Date-Time OPTIONAL | ||||||||||||||||||||||||||||
| 67 | } | ||||||||||||||||||||||||||||
| 68 | |||||||||||||||||||||||||||||
| 69 | =cut | ||||||||||||||||||||||||||||
| 70 | |||||||||||||||||||||||||||||
| 71 | =head1 METHODS | ||||||||||||||||||||||||||||
| 72 | |||||||||||||||||||||||||||||
| 73 | =cut | ||||||||||||||||||||||||||||
| 74 | |||||||||||||||||||||||||||||
| 75 | #--------------------------------------------------------------- | ||||||||||||||||||||||||||||
| 76 | # | ||||||||||||||||||||||||||||
| 77 | #--------------------------------------------------------------- | ||||||||||||||||||||||||||||
| 78 | =head1 | ||||||||||||||||||||||||||||
| 79 | |||||||||||||||||||||||||||||
| 80 | =head2 new( $service_date [, $original_date] ) | ||||||||||||||||||||||||||||
| 81 | |||||||||||||||||||||||||||||
| 82 | Creates a new ServiceDateTime object. | ||||||||||||||||||||||||||||
| 83 | Expects a date/time for the service (Biblio::ILL::ISO::DateTime), and | ||||||||||||||||||||||||||||
| 84 | (optionally) a date/time for the original service (Biblio::ILL::ISO::DateTime). | ||||||||||||||||||||||||||||
| 85 | |||||||||||||||||||||||||||||
| 86 | =cut | ||||||||||||||||||||||||||||
| 87 | 22 | ▶ | sub new { | ||||||||||||||||||||||||||
|
Subroutine
new: called CC=8 SCAR=21.6
Pod
documented
| |||||||||||||||||||||||||||||
| 88 | 22 | my $class = shift; | |||||||||||||||||||||||||||
| 89 | 22 | my $self = {}; | |||||||||||||||||||||||||||
| 90 | |||||||||||||||||||||||||||||
| 91 | 22 | ▶ | if (@_) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 92 | 22 | my ($refdtthis, $refdtorig) = @_; | |||||||||||||||||||||||||||
| 93 | |||||||||||||||||||||||||||||
| 94 | 22 | ▶ | croak "missing date-time-of-this-service" unless ($refdtthis); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 95 | 22 | ▶ | croak "invalid DateTime for this service" unless ((ref($refdtthis) eq "Biblio::ILL::ISO::DateTime")); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 96 | 22 | ▶ | if ($refdtorig) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 97 | 21 | ▶ | croak "invalid DateTime for original service" unless ((ref($refdtorig) eq "Biblio::ILL::ISO::DateTime")); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 98 | } | ||||||||||||||||||||||||||||
| 99 | |||||||||||||||||||||||||||||
| 100 | 22 | $self->{"date-time-of-this-service"} = $refdtthis; | |||||||||||||||||||||||||||
| 101 | 22 | ▶ | $self->{"date-time-of-original-service"} = $refdtorig if ($refdtorig); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 102 | } | ||||||||||||||||||||||||||||
| 103 | |||||||||||||||||||||||||||||
| 104 | 22 | ▶ | bless($self, ref($class) || $class); | ||||||||||||||||||||||||||
|
Condition33%1/3
ref $class || $class
MC/DC0%0/2
ref $class || $class
ref $class
$class
Truth table33%1/3
A || B
A= ref $classB= $class
| |||||||||||||||||||||||||||||
| 105 | 22 | return ($self); | |||||||||||||||||||||||||||
| 106 | } | ||||||||||||||||||||||||||||
| 107 | |||||||||||||||||||||||||||||
| 108 | |||||||||||||||||||||||||||||
| 109 | #--------------------------------------------------------------- | ||||||||||||||||||||||||||||
| 110 | # | ||||||||||||||||||||||||||||
| 111 | #--------------------------------------------------------------- | ||||||||||||||||||||||||||||
| 112 | =head1 | ||||||||||||||||||||||||||||
| 113 | |||||||||||||||||||||||||||||
| 114 | =head2 new( $service_date [, $original_date] ) | ||||||||||||||||||||||||||||
| 115 | |||||||||||||||||||||||||||||
| 116 | Sets the object's date-time-of-this-service (Biblio::ILL::ISO::DateTime), and | ||||||||||||||||||||||||||||
| 117 | (optionally) date-time-of-original-service (Biblio::ILL::ISO::DateTime). | ||||||||||||||||||||||||||||
| 118 | |||||||||||||||||||||||||||||
| 119 | =cut | ||||||||||||||||||||||||||||
| 120 | 0 | ▶ | sub set { | ||||||||||||||||||||||||||
|
Subroutine
set: not called CC=6 SCAR=37.4
Pod
undocumented
| |||||||||||||||||||||||||||||
| 121 | 0 | my $self = shift; | |||||||||||||||||||||||||||
| 122 | 0 | my ($refdtthis, $refdtorig) = @_; | |||||||||||||||||||||||||||
| 123 | |||||||||||||||||||||||||||||
| 124 | 0 | ▶ | croak "missing date-time-of-this-service" unless ($refdtthis); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 125 | 0 | ▶ | croak "invalid DateTime for this service" unless ((ref($refdtthis) eq "Biblio::ILL::ISO::DateTime")); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 126 | 0 | ▶ | if ($refdtorig) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 127 | 0 | ▶ | croak "invalid DateTime for original service" unless ((ref($refdtorig) eq "Biblio::ILL::ISO::DateTime")); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 128 | } | ||||||||||||||||||||||||||||
| 129 | |||||||||||||||||||||||||||||
| 130 | 0 | $self->{"date-time-of-this-service"} = $refdtthis; | |||||||||||||||||||||||||||
| 131 | 0 | ▶ | $self->{"date-time-of-original-service"} = $refdtorig if ($refdtorig); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 132 | |||||||||||||||||||||||||||||
| 133 | 0 | return; | |||||||||||||||||||||||||||
| 134 | } | ||||||||||||||||||||||||||||
| 135 | |||||||||||||||||||||||||||||
| 136 | #--------------------------------------------------------------- | ||||||||||||||||||||||||||||
| 137 | # | ||||||||||||||||||||||||||||
| 138 | #--------------------------------------------------------------- | ||||||||||||||||||||||||||||
| 139 | =head1 | ||||||||||||||||||||||||||||
| 140 | |||||||||||||||||||||||||||||
| 141 | =head2 from_asn($href) | ||||||||||||||||||||||||||||
| 142 | |||||||||||||||||||||||||||||
| 143 | Given a properly formatted hash, builds the object. | ||||||||||||||||||||||||||||
| 144 | |||||||||||||||||||||||||||||
| 145 | =cut | ||||||||||||||||||||||||||||
| 146 | 0 | ▶ | sub from_asn { | ||||||||||||||||||||||||||
|
Subroutine
from_asn: not called CC=4 SCAR=30.0
Pod
documented
| |||||||||||||||||||||||||||||
| 147 | 0 | my $self = shift; | |||||||||||||||||||||||||||
| 148 | 0 | my $href = shift; | |||||||||||||||||||||||||||
| 149 | |||||||||||||||||||||||||||||
| 150 | 0 | foreach my $k (keys %$href) { | |||||||||||||||||||||||||||
| 151 | #print ref($self) . "...$k\n"; | ||||||||||||||||||||||||||||
| 152 | |||||||||||||||||||||||||||||
| 153 | 0 | ▶ | if (($k =~ /^date-time-of-this-service$/) | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$k =~ /^date-time-of-this-service$/ or $k =~ /^date-time-of-original-service$/
MC/DC0%0/2
$k =~ /^date-time-of-this-service$/ or $k =~ /^date-time-of-original-service$/
$k =~ /^date-time-of-this-service$/
$k =~ /^date-time-of-original-service$/
Truth table0%0/3
A or B
A= $k =~ /^date-time-of-this-service$/B= $k =~ /^date-time-of-original-service$/
| |||||||||||||||||||||||||||||
| 154 | || ($k =~ /^date-time-of-original-service$/) | ||||||||||||||||||||||||||||
| 155 | ) { | ||||||||||||||||||||||||||||
| 156 | 0 | $self->{$k} = new Biblio::ILL::ISO::DateTime(); | |||||||||||||||||||||||||||
| 157 | 0 | $self->{$k}->from_asn($href->{$k}); | |||||||||||||||||||||||||||
| 158 | |||||||||||||||||||||||||||||
| 159 | } else { | ||||||||||||||||||||||||||||
| 160 | 0 | croak "invalid " . ref($self) . " element: [$k]"; | |||||||||||||||||||||||||||
| 161 | } | ||||||||||||||||||||||||||||
| 162 | |||||||||||||||||||||||||||||
| 163 | } | ||||||||||||||||||||||||||||
| 164 | 0 | return $self; | |||||||||||||||||||||||||||
| 165 | } | ||||||||||||||||||||||||||||
| 166 | |||||||||||||||||||||||||||||
| 167 | =head1 SEE ALSO | ||||||||||||||||||||||||||||
| 168 | |||||||||||||||||||||||||||||
| 169 | See the README for system design notes. | ||||||||||||||||||||||||||||
| 170 | See the parent class(es) for other available methods. | ||||||||||||||||||||||||||||
| 171 | |||||||||||||||||||||||||||||
| 172 | For more information on Interlibrary Loan standards (ISO 10160/10161), | ||||||||||||||||||||||||||||
| 173 | a good place to start is: | ||||||||||||||||||||||||||||
| 174 | |||||||||||||||||||||||||||||
| 175 | http://www.nlc-bnc.ca/iso/ill/main.htm | ||||||||||||||||||||||||||||
| 176 | |||||||||||||||||||||||||||||
| 177 | =cut | ||||||||||||||||||||||||||||
| 178 | |||||||||||||||||||||||||||||
| 179 | =head1 AUTHOR | ||||||||||||||||||||||||||||
| 180 | |||||||||||||||||||||||||||||
| 181 | David Christensen, <DChristensenSPAMLESS@westman.wave.ca> | ||||||||||||||||||||||||||||
| 182 | |||||||||||||||||||||||||||||
| 183 | =cut | ||||||||||||||||||||||||||||
| 184 | |||||||||||||||||||||||||||||
| 185 | |||||||||||||||||||||||||||||
| 186 | =head1 COPYRIGHT AND LICENSE | ||||||||||||||||||||||||||||
| 187 | |||||||||||||||||||||||||||||
| 188 | Copyright 2003 by David Christensen | ||||||||||||||||||||||||||||
| 189 | |||||||||||||||||||||||||||||
| 190 | This library is free software; you can redistribute it and/or modify it | ||||||||||||||||||||||||||||
| 191 | under the same terms as Perl itself. | ||||||||||||||||||||||||||||
| 192 | |||||||||||||||||||||||||||||
| 193 | =cut | ||||||||||||||||||||||||||||
| 194 | |||||||||||||||||||||||||||||
| 195 | 4 | 1; | |||||||||||||||||||||||||||