| 1 | package Biblio::ILL::ISO::LocationInfo; | ||||||||||||||||||||
| 2 | |||||||||||||||||||||
| 3 | =head1 NAME | ||||||||||||||||||||
| 4 | |||||||||||||||||||||
| 5 | Biblio::ILL::ISO::LocationInfo | ||||||||||||||||||||
| 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::SystemId; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 11 | 4 | ▶ | use Biblio::ILL::ISO::SystemAddress; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 12 | 4 | ▶ | use Biblio::ILL::ISO::ILLString; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 13 | |||||||||||||||||||||
| 14 | 4 | ▶ | use Carp; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 15 | |||||||||||||||||||||
| 16 | =head1 VERSION | ||||||||||||||||||||
| 17 | |||||||||||||||||||||
| 18 | Version 0.01 | ||||||||||||||||||||
| 19 | |||||||||||||||||||||
| 20 | =cut | ||||||||||||||||||||
| 21 | |||||||||||||||||||||
| 22 | 4 | our $VERSION = '0.01'; | |||||||||||||||||||
| 23 | #--------------------------------------------------------------------------- | ||||||||||||||||||||
| 24 | # Mods | ||||||||||||||||||||
| 25 | # 0.01 - 2003.07.27 - original version | ||||||||||||||||||||
| 26 | #--------------------------------------------------------------------------- | ||||||||||||||||||||
| 27 | |||||||||||||||||||||
| 28 | =head1 DESCRIPTION | ||||||||||||||||||||
| 29 | |||||||||||||||||||||
| 30 | Biblio::ILL::ISO::LocationInfo is a derivation of Biblio::ILL::ISO::ILLASNtype. | ||||||||||||||||||||
| 31 | |||||||||||||||||||||
| 32 | =head1 USES | ||||||||||||||||||||
| 33 | |||||||||||||||||||||
| 34 | Biblio::ILL::ISO::SystemId; | ||||||||||||||||||||
| 35 | Biblio::ILL::ISO::SystemAddress; | ||||||||||||||||||||
| 36 | Biblio::ILL::ISO::ILLString; | ||||||||||||||||||||
| 37 | |||||||||||||||||||||
| 38 | =head1 USED IN | ||||||||||||||||||||
| 39 | |||||||||||||||||||||
| 40 | Biblio::ILL::ISO::LocationInfoSequence | ||||||||||||||||||||
| 41 | |||||||||||||||||||||
| 42 | =cut | ||||||||||||||||||||
| 43 | |||||||||||||||||||||
| 44 | 4 | ▶ | BEGIN{@ISA = qw ( Biblio::ILL::ISO::ILLASNtype );} # inherit from ILLASNtype | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 45 | |||||||||||||||||||||
| 46 | =head1 FROM THE ASN DEFINITION | ||||||||||||||||||||
| 47 | |||||||||||||||||||||
| 48 | Location-Info ::= EXPLICIT SEQUENCE { | ||||||||||||||||||||
| 49 | location-id [0] IMPLICIT System-Id, | ||||||||||||||||||||
| 50 | location-address [1] IMPLICIT System-Address OPTIONAL, | ||||||||||||||||||||
| 51 | location-note [2] ILL-String OPTIONAL | ||||||||||||||||||||
| 52 | } | ||||||||||||||||||||
| 53 | |||||||||||||||||||||
| 54 | =cut | ||||||||||||||||||||
| 55 | |||||||||||||||||||||
| 56 | =head1 METHODS | ||||||||||||||||||||
| 57 | |||||||||||||||||||||
| 58 | =cut | ||||||||||||||||||||
| 59 | |||||||||||||||||||||
| 60 | #--------------------------------------------------------------- | ||||||||||||||||||||
| 61 | # | ||||||||||||||||||||
| 62 | #--------------------------------------------------------------- | ||||||||||||||||||||
| 63 | =head1 | ||||||||||||||||||||
| 64 | |||||||||||||||||||||
| 65 | =head2 new( $loc_id [,$loc_addr] [,$note] ) | ||||||||||||||||||||
| 66 | |||||||||||||||||||||
| 67 | Creates a new LocationInfo object. | ||||||||||||||||||||
| 68 | Expects a location-id (Biblio::ILL::ISO::SystemId), | ||||||||||||||||||||
| 69 | (optionally) a location-address (Biblio::ILL::ISO::SystemAddress), and | ||||||||||||||||||||
| 70 | (optionally) a location-note (Biblio::ILL::ISO::ILLString). | ||||||||||||||||||||
| 71 | |||||||||||||||||||||
| 72 | =cut | ||||||||||||||||||||
| 73 | 4 | ▶ | sub new { | ||||||||||||||||||
|
Subroutine
new: called CC=10 SCAR=24.4
Pod
documented
| |||||||||||||||||||||
| 74 | 4 | my $class = shift; | |||||||||||||||||||
| 75 | 4 | my $self = {}; | |||||||||||||||||||
| 76 | |||||||||||||||||||||
| 77 | 4 | ▶ | if (@_) { | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 78 | 4 | my ($locid, $locaddr, $locnote) = @_; | |||||||||||||||||||
| 79 | |||||||||||||||||||||
| 80 | 4 | ▶ | croak "invalid location-id" unless (ref($locid) eq "Biblio::ILL::ISO::SystemId"); | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 81 | 4 | ▶ | if ($locaddr) { | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 82 | 4 | ▶ | croak "invalid location-address" unless (ref($locaddr) eq "Biblio::ILL::ISO::SystemAddress"); | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 83 | } | ||||||||||||||||||||
| 84 | 4 | ▶ | if ($locnote) { | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 85 | 2 | ▶ | croak "invalid location-note" unless (ref($locnote) eq "Biblio::ILL::ISO::ILLString"); | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 86 | } | ||||||||||||||||||||
| 87 | |||||||||||||||||||||
| 88 | 4 | $self->{"location-id"} = $locid; | |||||||||||||||||||
| 89 | 4 | ▶ | $self->{"location-address"} = $locaddr if ($locaddr); | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 90 | 4 | ▶ | $self->{"location-note"} = $locnote if ($locnote); | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 91 | } | ||||||||||||||||||||
| 92 | |||||||||||||||||||||
| 93 | 4 | ▶ | 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
| |||||||||||||||||||||
| 94 | 4 | return ($self); | |||||||||||||||||||
| 95 | } | ||||||||||||||||||||
| 96 | |||||||||||||||||||||
| 97 | |||||||||||||||||||||
| 98 | #--------------------------------------------------------------- | ||||||||||||||||||||
| 99 | # | ||||||||||||||||||||
| 100 | #--------------------------------------------------------------- | ||||||||||||||||||||
| 101 | =head1 | ||||||||||||||||||||
| 102 | |||||||||||||||||||||
| 103 | =head2 set( $loc_id [,$loc_addr] [,$note] ) | ||||||||||||||||||||
| 104 | |||||||||||||||||||||
| 105 | Sets the object's location-id, location-address, and note. | ||||||||||||||||||||
| 106 | Expects a location-id (Biblio::ILL::ISO::SystemId), | ||||||||||||||||||||
| 107 | (optionally) a location-address (Biblio::ILL::ISO::SystemAddress), and | ||||||||||||||||||||
| 108 | (optionally) a location-note (Biblio::ILL::ISO::ILLString). | ||||||||||||||||||||
| 109 | |||||||||||||||||||||
| 110 | =cut | ||||||||||||||||||||
| 111 | 0 | ▶ | sub set { | ||||||||||||||||||
|
Subroutine
set: not called CC=8 SCAR=42.8
Pod
documented
| |||||||||||||||||||||
| 112 | 0 | my $self = shift; | |||||||||||||||||||
| 113 | |||||||||||||||||||||
| 114 | 0 | my ($locid, $locaddr, $locnote) = @_; | |||||||||||||||||||
| 115 | |||||||||||||||||||||
| 116 | 0 | ▶ | croak "invalid location-id" unless (ref($locid) eq "Biblio::ILL::ISO::SystemId"); | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 117 | 0 | ▶ | if ($locaddr) { | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 118 | 0 | ▶ | croak "invalid location-address" unless (ref($locaddr) eq "Biblio::ILL::ISO::SystemAddress"); | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 119 | } | ||||||||||||||||||||
| 120 | 0 | ▶ | if ($locnote) { | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 121 | 0 | ▶ | croak "invalid location-note" unless (ref($locnote) eq "Biblio::ILL::ISO::ILLString"); | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 122 | } | ||||||||||||||||||||
| 123 | |||||||||||||||||||||
| 124 | 0 | $self->{"location-id"} = $locid; | |||||||||||||||||||
| 125 | 0 | ▶ | $self->{"location-address"} = $locaddr if ($locaddr); | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 126 | 0 | ▶ | $self->{"location-note"} = $locnote if ($locnote); | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 127 | |||||||||||||||||||||
| 128 | 0 | return; | |||||||||||||||||||
| 129 | } | ||||||||||||||||||||
| 130 | |||||||||||||||||||||
| 131 | |||||||||||||||||||||
| 132 | #--------------------------------------------------------------- | ||||||||||||||||||||
| 133 | # | ||||||||||||||||||||
| 134 | #--------------------------------------------------------------- | ||||||||||||||||||||
| 135 | =head1 | ||||||||||||||||||||
| 136 | |||||||||||||||||||||
| 137 | =head2 from_asn($href) | ||||||||||||||||||||
| 138 | |||||||||||||||||||||
| 139 | Given a properly formatted hash, builds the object. | ||||||||||||||||||||
| 140 | |||||||||||||||||||||
| 141 | =cut | ||||||||||||||||||||
| 142 | 0 | ▶ | sub from_asn { | ||||||||||||||||||
|
Subroutine
from_asn: not called CC=5 SCAR=34.0
Pod
documented
| |||||||||||||||||||||
| 143 | 0 | my $self = shift; | |||||||||||||||||||
| 144 | 0 | my $href = shift; | |||||||||||||||||||
| 145 | |||||||||||||||||||||
| 146 | 0 | foreach my $k (keys %$href) { | |||||||||||||||||||
| 147 | #print ref($self) . "...$k\n"; | ||||||||||||||||||||
| 148 | |||||||||||||||||||||
| 149 | 0 | ▶ | if ($k =~ /^location-id$/) { | ||||||||||||||||||
|
Branch: 3 branches
| |||||||||||||||||||||
| 150 | 0 | $self->{$k} = new Biblio::ILL::ISO::SystemId(); | |||||||||||||||||||
| 151 | 0 | $self->{$k}->from_asn($href->{$k}); | |||||||||||||||||||
| 152 | |||||||||||||||||||||
| 153 | } elsif ($k =~ /^location-address$/) { | ||||||||||||||||||||
| 154 | 0 | $self->{$k} = new Biblio::ILL::ISO::SystemAddress(); | |||||||||||||||||||
| 155 | 0 | $self->{$k}->from_asn($href->{$k}); | |||||||||||||||||||
| 156 | |||||||||||||||||||||
| 157 | } elsif ($k =~ /^location-note$/) { | ||||||||||||||||||||
| 158 | 0 | $self->{$k} = new Biblio::ILL::ISO::ILLString(); | |||||||||||||||||||
| 159 | 0 | $self->{$k}->from_asn($href->{$k}); | |||||||||||||||||||
| 160 | |||||||||||||||||||||
| 161 | } else { | ||||||||||||||||||||
| 162 | 0 | croak "invalid " . ref($self) . " element: [$k]"; | |||||||||||||||||||
| 163 | } | ||||||||||||||||||||
| 164 | |||||||||||||||||||||
| 165 | } | ||||||||||||||||||||
| 166 | 0 | return $self; | |||||||||||||||||||
| 167 | } | ||||||||||||||||||||
| 168 | |||||||||||||||||||||
| 169 | =head1 SEE ALSO | ||||||||||||||||||||
| 170 | |||||||||||||||||||||
| 171 | See the README for system design notes. | ||||||||||||||||||||
| 172 | See the parent class(es) for other available methods. | ||||||||||||||||||||
| 173 | |||||||||||||||||||||
| 174 | For more information on Interlibrary Loan standards (ISO 10160/10161), | ||||||||||||||||||||
| 175 | a good place to start is: | ||||||||||||||||||||
| 176 | |||||||||||||||||||||
| 177 | http://www.nlc-bnc.ca/iso/ill/main.htm | ||||||||||||||||||||
| 178 | |||||||||||||||||||||
| 179 | =cut | ||||||||||||||||||||
| 180 | |||||||||||||||||||||
| 181 | =head1 AUTHOR | ||||||||||||||||||||
| 182 | |||||||||||||||||||||
| 183 | David Christensen, <DChristensenSPAMLESS@westman.wave.ca> | ||||||||||||||||||||
| 184 | |||||||||||||||||||||
| 185 | =cut | ||||||||||||||||||||
| 186 | |||||||||||||||||||||
| 187 | |||||||||||||||||||||
| 188 | =head1 COPYRIGHT AND LICENSE | ||||||||||||||||||||
| 189 | |||||||||||||||||||||
| 190 | Copyright 2003 by David Christensen | ||||||||||||||||||||
| 191 | |||||||||||||||||||||
| 192 | This library is free software; you can redistribute it and/or modify it | ||||||||||||||||||||
| 193 | under the same terms as Perl itself. | ||||||||||||||||||||
| 194 | |||||||||||||||||||||
| 195 | =cut | ||||||||||||||||||||
| 196 | |||||||||||||||||||||
| 197 | 4 | 1; | |||||||||||||||||||