| line | stmt | bran | cond | sub | pod | time | code | 
| 1 |  |  |  |  |  |  | package Biblio::ILL::ISO::ThirdPartyInfoType; | 
| 2 |  |  |  |  |  |  |  | 
| 3 |  |  |  |  |  |  | =head1 NAME | 
| 4 |  |  |  |  |  |  |  | 
| 5 |  |  |  |  |  |  | Biblio::ILL::ISO::ThirdPartyInfoType | 
| 6 |  |  |  |  |  |  |  | 
| 7 |  |  |  |  |  |  | =cut | 
| 8 |  |  |  |  |  |  |  | 
| 9 | 4 |  |  | 4 |  | 872 | use Biblio::ILL::ISO::ILLASNtype; | 
|  | 4 |  |  |  |  | 10 |  | 
|  | 4 |  |  |  |  | 114 |  | 
| 10 | 4 |  |  | 4 |  | 25 | use Biblio::ILL::ISO::SystemAddress; | 
|  | 4 |  |  |  |  | 9 |  | 
|  | 4 |  |  |  |  | 84 |  | 
| 11 | 4 |  |  | 4 |  | 24 | use Biblio::ILL::ISO::Preference; | 
|  | 4 |  |  |  |  | 6 |  | 
|  | 4 |  |  |  |  | 99 |  | 
| 12 | 4 |  |  | 4 |  | 32 | use Biblio::ILL::ISO::SendToListTypeSequence; | 
|  | 4 |  |  |  |  | 12 |  | 
|  | 4 |  |  |  |  | 119 |  | 
| 13 | 4 |  |  | 4 |  | 24 | use Biblio::ILL::ISO::AlreadyTriedListType; | 
|  | 4 |  |  |  |  | 8 |  | 
|  | 4 |  |  |  |  | 96 |  | 
| 14 |  |  |  |  |  |  |  | 
| 15 | 4 |  |  | 4 |  | 25 | use Carp; | 
|  | 4 |  |  |  |  | 13 |  | 
|  | 4 |  |  |  |  | 414 |  | 
| 16 |  |  |  |  |  |  |  | 
| 17 |  |  |  |  |  |  | =head1 VERSION | 
| 18 |  |  |  |  |  |  |  | 
| 19 |  |  |  |  |  |  | Version 0.01 | 
| 20 |  |  |  |  |  |  |  | 
| 21 |  |  |  |  |  |  | =cut | 
| 22 |  |  |  |  |  |  |  | 
| 23 |  |  |  |  |  |  | our $VERSION = '0.01'; | 
| 24 |  |  |  |  |  |  | #--------------------------------------------------------------------------- | 
| 25 |  |  |  |  |  |  | # Mods | 
| 26 |  |  |  |  |  |  | # 0.01 - 2003.07.15 - original version | 
| 27 |  |  |  |  |  |  | #--------------------------------------------------------------------------- | 
| 28 |  |  |  |  |  |  |  | 
| 29 |  |  |  |  |  |  | =head1 DESCRIPTION | 
| 30 |  |  |  |  |  |  |  | 
| 31 |  |  |  |  |  |  | Biblio::ILL::ISO::ThirdPartyInfoType is a derivation of Biblio::ILL::ISO::ILLASNtype. | 
| 32 |  |  |  |  |  |  |  | 
| 33 |  |  |  |  |  |  | =head1 USES | 
| 34 |  |  |  |  |  |  |  | 
| 35 |  |  |  |  |  |  | Biblio::ILL::ISO::SystemAddress | 
| 36 |  |  |  |  |  |  | Biblio::ILL::ISO::Preference | 
| 37 |  |  |  |  |  |  | Biblio::ILL::ISO::SendToListTypeSequence | 
| 38 |  |  |  |  |  |  | Biblio::ILL::ISO::AlreadyTriedListType | 
| 39 |  |  |  |  |  |  |  | 
| 40 |  |  |  |  |  |  | =head1 USED IN | 
| 41 |  |  |  |  |  |  |  | 
| 42 |  |  |  |  |  |  | Biblio::ILL::ISO::Request | 
| 43 |  |  |  |  |  |  |  | 
| 44 |  |  |  |  |  |  | =cut | 
| 45 |  |  |  |  |  |  |  | 
| 46 | 4 |  |  | 4 |  | 5145 | BEGIN{@ISA = qw ( Biblio::ILL::ISO::ILLASNtype );}   # inherit from ILLASNtype | 
| 47 |  |  |  |  |  |  |  | 
| 48 |  |  |  |  |  |  | =head1 FROM THE ASN DEFINITION | 
| 49 |  |  |  |  |  |  |  | 
| 50 |  |  |  |  |  |  | Third-Party-Info-Type ::= SEQUENCE { | 
| 51 |  |  |  |  |  |  | permission-to-forward	[0]	IMPLICIT BOOLEAN, -- DEFAULT FALSE, | 
| 52 |  |  |  |  |  |  | permission-to-chain	[1]	IMPLICIT BOOLEAN, -- DEFAULT FALSE, | 
| 53 |  |  |  |  |  |  | permission-to-partition 	[2]	IMPLICIT BOOLEAN, -- DEFAULT FALSE, | 
| 54 |  |  |  |  |  |  | permission-to-change-send-to-list [3]	IMPLICIT BOOLEAN, -- DEFAULT FALSE, | 
| 55 |  |  |  |  |  |  | initial-requester-address 	[4]	IMPLICIT System-Address OPTIONAL, | 
| 56 |  |  |  |  |  |  | -- mandatory when initiating a FORWARD service or an | 
| 57 |  |  |  |  |  |  | -- ILL-REQUEST service for a partitioned ILL | 
| 58 |  |  |  |  |  |  | -- sub-transaction; optional otherwise | 
| 59 |  |  |  |  |  |  | preference	[5]	IMPLICIT ENUMERATED { | 
| 60 |  |  |  |  |  |  | ordered	(1), | 
| 61 |  |  |  |  |  |  | unordered	(2) | 
| 62 |  |  |  |  |  |  | } -- DEFAULT 2, | 
| 63 |  |  |  |  |  |  | send-to-list	[6]	IMPLICIT Send-To-List-Type OPTIONAL, | 
| 64 |  |  |  |  |  |  | already-tried-list	[7]	IMPLICIT Already-Tried-List-Type OPTIONAL | 
| 65 |  |  |  |  |  |  | -- mandatory when initiating a FORWARD service, or when | 
| 66 |  |  |  |  |  |  | -- initiating an ILL-REQUEST service for an ILL | 
| 67 |  |  |  |  |  |  | -- sub-transaction if the received ILL-REQUEST included an | 
| 68 |  |  |  |  |  |  | -- "already-tried-list"; optional otherwise | 
| 69 |  |  |  |  |  |  | } | 
| 70 |  |  |  |  |  |  |  | 
| 71 |  |  |  |  |  |  | =cut | 
| 72 |  |  |  |  |  |  |  | 
| 73 |  |  |  |  |  |  | =head1 METHODS | 
| 74 |  |  |  |  |  |  |  | 
| 75 |  |  |  |  |  |  | =cut | 
| 76 |  |  |  |  |  |  |  | 
| 77 |  |  |  |  |  |  | #--------------------------------------------------------------- | 
| 78 |  |  |  |  |  |  | # | 
| 79 |  |  |  |  |  |  | #--------------------------------------------------------------- | 
| 80 |  |  |  |  |  |  | =head1 | 
| 81 |  |  |  |  |  |  |  | 
| 82 |  |  |  |  |  |  | =head2 new( $forward, $chain, $partition, $change, $pref [,$refrequester [,$refsendto [,$refalreadytried]]]] ) | 
| 83 |  |  |  |  |  |  |  | 
| 84 |  |  |  |  |  |  | Creates a new ThirdPartyInfoType object. | 
| 85 |  |  |  |  |  |  | Expects a can-forward flag ( 0|1 ), | 
| 86 |  |  |  |  |  |  | a can-chain flag ( 0|1 ), | 
| 87 |  |  |  |  |  |  | a can-partition flag ( 0|1 ), | 
| 88 |  |  |  |  |  |  | a can-change flag ( 0|1 ), | 
| 89 |  |  |  |  |  |  | a preference for ordered or unordered (Biblio::ILL::ISO::Preference), | 
| 90 |  |  |  |  |  |  | (optionally) an initial-requester address (Biblio::ILL::ISO::SystemAddress), | 
| 91 |  |  |  |  |  |  | (optionally) a send-to list (Biblio::ILL::ISO::SendToListTypeSequence), and | 
| 92 |  |  |  |  |  |  | (optionally) an already-tried list (Biblio::ILL::ISO::AlreadyTriedListType). | 
| 93 |  |  |  |  |  |  |  | 
| 94 |  |  |  |  |  |  | =cut | 
| 95 |  |  |  |  |  |  | sub new { | 
| 96 | 3 |  |  | 3 | 1 | 14 | my $class = shift; | 
| 97 | 3 |  |  |  |  | 11 | my $self = {}; | 
| 98 |  |  |  |  |  |  |  | 
| 99 | 3 |  |  |  |  | 7 | my ($forward, $chain, $partition, $change, $pref, | 
| 100 |  |  |  |  |  |  | $refrequester, $refsendto, $refalreadytried) = @_; | 
| 101 |  |  |  |  |  |  |  | 
| 102 | 3 | 100 |  |  |  | 15 | $forward   = 0 unless ($forward); | 
| 103 | 3 | 100 |  |  |  | 8 | $chain     = 0 unless ($chain); | 
| 104 | 3 | 100 |  |  |  | 17 | $partition = 0 unless ($partition); | 
| 105 | 3 | 100 |  |  |  | 7 | $change    = 0 unless ($change); | 
| 106 | 3 | 100 |  |  |  | 8 | $pref = "unordered" unless ($pref); | 
| 107 | 3 | 100 |  |  |  | 15 | if ($refrequester) { | 
| 108 | 2 | 50 |  |  |  | 8 | croak "invalid initial-requester-address" unless (ref($refrequester) eq "Biblio::ILL::ISO::SystemAddress"); | 
| 109 |  |  |  |  |  |  | } | 
| 110 | 3 | 100 |  |  |  | 7 | if ($refsendto) { | 
| 111 | 2 | 50 |  |  |  | 7 | croak "invalid send-to-list" unless (ref($refsendto) eq "Biblio::ILL::ISO::SendToListTypeSequence"); | 
| 112 |  |  |  |  |  |  | } | 
| 113 | 3 | 100 |  |  |  | 6 | if ($refalreadytried) { | 
| 114 | 2 | 50 |  |  |  | 9 | croak "invalid already-tried-list" unless (ref($refalreadytried) eq "Biblio::ILL::ISO::AlreadyTriedListType"); | 
| 115 |  |  |  |  |  |  | } | 
| 116 |  |  |  |  |  |  |  | 
| 117 | 3 |  |  |  |  | 7 | $self->{"permission-to-forward"} = $forward; | 
| 118 | 3 |  |  |  |  | 6 | $self->{"permission-to-chain"} = $chain; | 
| 119 | 3 |  |  |  |  | 7 | $self->{"permission-to-partition"} = $partition; | 
| 120 | 3 |  |  |  |  | 5 | $self->{"permission-to-change-send-to-list"} = $change; | 
| 121 | 3 |  |  |  |  | 22 | $self->{"preference"} = new Biblio::ILL::ISO::Preference($pref); | 
| 122 | 3 | 100 |  |  |  | 9 | $self->{"initial-requester-address"} = $refrequester if ($refrequester); | 
| 123 | 3 | 100 |  |  |  | 8 | $self->{"send-to-list"} = $refsendto if ($refsendto); | 
| 124 | 3 | 100 |  |  |  | 10 | $self->{"already-tried-list"} = $refalreadytried if ($refalreadytried); | 
| 125 |  |  |  |  |  |  |  | 
| 126 | 3 |  | 33 |  |  | 21 | bless($self, ref($class) || $class); | 
| 127 | 3 |  |  |  |  | 8 | return ($self); | 
| 128 |  |  |  |  |  |  | } | 
| 129 |  |  |  |  |  |  |  | 
| 130 |  |  |  |  |  |  |  | 
| 131 |  |  |  |  |  |  | #--------------------------------------------------------------- | 
| 132 |  |  |  |  |  |  | # | 
| 133 |  |  |  |  |  |  | #--------------------------------------------------------------- | 
| 134 |  |  |  |  |  |  | =head1 | 
| 135 |  |  |  |  |  |  |  | 
| 136 |  |  |  |  |  |  | =head2 set( $forward, $chain, $partition, $change, $pref [,$refrequester [,$refsendto [,$refalreadytried]]]] ) | 
| 137 |  |  |  |  |  |  |  | 
| 138 |  |  |  |  |  |  | Sets the object's forward flag ( 0|1 ), | 
| 139 |  |  |  |  |  |  | can-chain flag ( 0|1 ), | 
| 140 |  |  |  |  |  |  | can-partition flag ( 0|1 ), | 
| 141 |  |  |  |  |  |  | can-change flag ( 0|1 ), | 
| 142 |  |  |  |  |  |  | preference for ordered or unordered (Biblio::ILL::ISO::Preference), | 
| 143 |  |  |  |  |  |  | (optionally) initial-requester address (Biblio::ILL::ISO::SystemAddress), | 
| 144 |  |  |  |  |  |  | (optionally) send-to list (Biblio::ILL::ISO::SendToListTypeSequence), and | 
| 145 |  |  |  |  |  |  | (optionally) already-tried list (Biblio::ILL::ISO::AlreadyTriedListType). | 
| 146 |  |  |  |  |  |  |  | 
| 147 |  |  |  |  |  |  | =cut | 
| 148 |  |  |  |  |  |  | sub set { | 
| 149 | 0 |  |  | 0 | 1 |  | my $self = shift; | 
| 150 | 0 |  |  |  |  |  | my ($forward, $chain, $partition, $change, $pref, | 
| 151 |  |  |  |  |  |  | $refrequester, $refsendto, $refalreadytried) = @_; | 
| 152 |  |  |  |  |  |  |  | 
| 153 | 0 | 0 |  |  |  |  | $forward = 0 unless ($forward); | 
| 154 | 0 | 0 |  |  |  |  | $chain   = 0 unless ($chain); | 
| 155 | 0 | 0 |  |  |  |  | $partition = 0 unless ($partition); | 
| 156 | 0 | 0 |  |  |  |  | $pref = new Biblio::ILL::ISO::Preference("unordered") unless ($pref); | 
| 157 | 0 | 0 |  |  |  |  | if ($refrequester) { | 
| 158 | 0 | 0 |  |  |  |  | croak "invalid initial-requester-address" unless (ref($refrequester) eq "Biblio::ILL::ISO::SystemAddress"); | 
| 159 |  |  |  |  |  |  | } | 
| 160 | 0 | 0 |  |  |  |  | if ($refsendto) { | 
| 161 | 0 | 0 |  |  |  |  | croak "invalid send-to-list" unless (ref($refsendto) eq "Biblio::ILL::ISO::SendToListTypeSequence"); | 
| 162 |  |  |  |  |  |  | } | 
| 163 | 0 | 0 |  |  |  |  | if ($refalreadytried) { | 
| 164 | 0 | 0 |  |  |  |  | croak "invalid already-tried-list" unless (ref($refalreadytried) eq "Biblio::ILL::ISO::AlreadyTriedListType"); | 
| 165 |  |  |  |  |  |  | } | 
| 166 |  |  |  |  |  |  |  | 
| 167 | 0 |  |  |  |  |  | $self->{"permission-to-forward"} = $forward; | 
| 168 | 0 |  |  |  |  |  | $self->{"permission-to-chain"} = $chain; | 
| 169 | 0 |  |  |  |  |  | $self->{"permission-to-partition"} = $partition; | 
| 170 | 0 |  |  |  |  |  | $self->{"permission-to-change-send-to-list"} = $change; | 
| 171 | 0 |  |  |  |  |  | $self->{"preference"} = new Biblio::ILL::ISO::Preference($pref); | 
| 172 | 0 | 0 |  |  |  |  | $self->{"initial-requester-address"} = $refrequester if ($refrequester); | 
| 173 | 0 | 0 |  |  |  |  | $self->{"send-to-list"} = $refsendto if ($refsendto); | 
| 174 | 0 | 0 |  |  |  |  | $self->{"already-tried-list"} = $refalreadytried if ($refalreadytried); | 
| 175 |  |  |  |  |  |  |  | 
| 176 | 0 |  |  |  |  |  | return; | 
| 177 |  |  |  |  |  |  | } | 
| 178 |  |  |  |  |  |  |  | 
| 179 |  |  |  |  |  |  | #--------------------------------------------------------------- | 
| 180 |  |  |  |  |  |  | # | 
| 181 |  |  |  |  |  |  | #--------------------------------------------------------------- | 
| 182 |  |  |  |  |  |  | =head1 | 
| 183 |  |  |  |  |  |  |  | 
| 184 |  |  |  |  |  |  | =head2 from_asn($href) | 
| 185 |  |  |  |  |  |  |  | 
| 186 |  |  |  |  |  |  | Given a properly formatted hash, builds the object. | 
| 187 |  |  |  |  |  |  |  | 
| 188 |  |  |  |  |  |  | =cut | 
| 189 |  |  |  |  |  |  | sub from_asn { | 
| 190 | 0 |  |  | 0 | 1 |  | my $self = shift; | 
| 191 | 0 |  |  |  |  |  | my $href = shift; | 
| 192 |  |  |  |  |  |  |  | 
| 193 | 0 |  |  |  |  |  | foreach my $k (keys %$href) { | 
| 194 |  |  |  |  |  |  | #print ref($self) . "...$k\n"; | 
| 195 |  |  |  |  |  |  |  | 
| 196 | 0 | 0 | 0 |  |  |  | if (($k =~ /^permission-to-forward$/) | 
|  |  | 0 | 0 |  |  |  |  | 
|  |  | 0 | 0 |  |  |  |  | 
|  |  | 0 |  |  |  |  |  | 
|  |  | 0 |  |  |  |  |  | 
| 197 |  |  |  |  |  |  | || ($k =~ /^permission-to-chain$/) | 
| 198 |  |  |  |  |  |  | || ($k =~ /^permission-to-partition$/) | 
| 199 |  |  |  |  |  |  | || ($k =~ /^permission-to-change-send-to-list$/) | 
| 200 |  |  |  |  |  |  | ) { | 
| 201 | 0 |  |  |  |  |  | $self->{$k} = $href->{$k}; | 
| 202 |  |  |  |  |  |  |  | 
| 203 |  |  |  |  |  |  | } elsif ($k =~ /^initial-requester-address$/) { | 
| 204 | 0 |  |  |  |  |  | $self->{$k} = new Biblio::ILL::ISO::SystemAddress(); | 
| 205 | 0 |  |  |  |  |  | $self->{$k}->from_asn($href->{$k}); | 
| 206 |  |  |  |  |  |  |  | 
| 207 |  |  |  |  |  |  | } elsif ($k =~ /^preference$/) { | 
| 208 | 0 |  |  |  |  |  | $self->{$k} = new Biblio::ILL::ISO::Preference(); | 
| 209 | 0 |  |  |  |  |  | $self->{$k}->from_asn($href->{$k}); | 
| 210 |  |  |  |  |  |  |  | 
| 211 |  |  |  |  |  |  | } elsif ($k =~ /^send-to-list$/) { | 
| 212 | 0 |  |  |  |  |  | $self->{$k} = new Biblio::ILL::ISO::SendToListTypeSequence(); | 
| 213 | 0 |  |  |  |  |  | $self->{$k}->from_asn($href->{$k}); | 
| 214 |  |  |  |  |  |  |  | 
| 215 |  |  |  |  |  |  | } elsif ($k =~ /^already-tried-list$/) { | 
| 216 | 0 |  |  |  |  |  | $self->{$k} = new Biblio::ILL::ISO::AlreadyTriedListType(); | 
| 217 | 0 |  |  |  |  |  | $self->{$k}->from_asn($href->{$k}); | 
| 218 |  |  |  |  |  |  |  | 
| 219 |  |  |  |  |  |  | } else { | 
| 220 | 0 |  |  |  |  |  | croak "invalid " . ref($self) . " element: [$k]"; | 
| 221 |  |  |  |  |  |  | } | 
| 222 |  |  |  |  |  |  |  | 
| 223 |  |  |  |  |  |  | } | 
| 224 | 0 |  |  |  |  |  | return $self; | 
| 225 |  |  |  |  |  |  | } | 
| 226 |  |  |  |  |  |  |  | 
| 227 |  |  |  |  |  |  | =head1 SEE ALSO | 
| 228 |  |  |  |  |  |  |  | 
| 229 |  |  |  |  |  |  | See the README for system design notes. | 
| 230 |  |  |  |  |  |  | See the parent class(es) for other available methods. | 
| 231 |  |  |  |  |  |  |  | 
| 232 |  |  |  |  |  |  | For more information on Interlibrary Loan standards (ISO 10160/10161), | 
| 233 |  |  |  |  |  |  | a good place to start is: | 
| 234 |  |  |  |  |  |  |  | 
| 235 |  |  |  |  |  |  | http://www.nlc-bnc.ca/iso/ill/main.htm | 
| 236 |  |  |  |  |  |  |  | 
| 237 |  |  |  |  |  |  | =cut | 
| 238 |  |  |  |  |  |  |  | 
| 239 |  |  |  |  |  |  | =head1 AUTHOR | 
| 240 |  |  |  |  |  |  |  | 
| 241 |  |  |  |  |  |  | David Christensen, | 
| 242 |  |  |  |  |  |  |  | 
| 243 |  |  |  |  |  |  | =cut | 
| 244 |  |  |  |  |  |  |  | 
| 245 |  |  |  |  |  |  |  | 
| 246 |  |  |  |  |  |  | =head1 COPYRIGHT AND LICENSE | 
| 247 |  |  |  |  |  |  |  | 
| 248 |  |  |  |  |  |  | Copyright 2003 by David Christensen | 
| 249 |  |  |  |  |  |  |  | 
| 250 |  |  |  |  |  |  | This library is free software; you can redistribute it and/or modify it | 
| 251 |  |  |  |  |  |  | under the same terms as Perl itself. | 
| 252 |  |  |  |  |  |  |  | 
| 253 |  |  |  |  |  |  | =cut | 
| 254 |  |  |  |  |  |  |  | 
| 255 |  |  |  |  |  |  | 1; |