File Coverage

blib/lib/Biblio/ILL/ISO/ItemId.pm
Criterion Covered Total %
statement 41 121 33.8
branch 8 56 14.2
condition 1 57 1.7
subroutine 11 29 37.9
pod 23 23 100.0
total 84 286 29.3


line stmt bran cond sub pod time code
1             package Biblio::ILL::ISO::ItemId;
2              
3             =head1 NAME
4              
5             Biblio::ILL::ISO::ItemId
6              
7             =cut
8              
9 4     4   989 use Biblio::ILL::ISO::ILLASNtype;
  4         9  
  4         96  
10 4     4   21 use Biblio::ILL::ISO::ILLString;
  4         7  
  4         72  
11 4     4   2494 use Biblio::ILL::ISO::ItemType;
  4         11  
  4         147  
12 4     4   2290 use Biblio::ILL::ISO::MediumType;
  4         12  
  4         131  
13              
14 4     4   23 use Carp;
  4         8  
  4         444  
15              
16             =head1 VERSION
17              
18             Version 0.01
19              
20             =cut
21              
22             our $VERSION = '0.01';
23             #---------------------------------------------------------------------------
24             # Mods
25             # 0.01 - 2003.07.15 - original version
26             #---------------------------------------------------------------------------
27              
28             =head1 DESCRIPTION
29              
30             Biblio::ILL::ISO::ItemId is a derivation of Biblio::ILL::ISO::ILLASNtype.
31              
32             =head1 USES
33              
34             Biblio::ILL::ISO::ILLString
35             Biblio::ILL::ISO::ItemType
36             Biblio::ILL::ISO::MediumType
37              
38             =head1 USED IN
39              
40             Biblio::ILL::ISO::Request
41              
42             =cut
43              
44 4     4   8348 BEGIN{@ISA = qw ( Biblio::ILL::ISO::ILLASNtype );} # inherit from ILLASNtype
45              
46             =head1 FROM THE ASN DEFINITION
47            
48             Item-Id ::= SEQUENCE {
49             item-type [0] IMPLICIT Item-Type OPTIONAL,
50             held-medium-type [1] IMPLICIT Medium-Type OPTIONAL,
51             call-number [2] ILL-String OPTIONAL,
52             author [3] ILL-String OPTIONAL,
53             title [4] ILL-String OPTIONAL,
54             sub-title [5] ILL-String OPTIONAL,
55             sponsoring-body [6] ILL-String OPTIONAL,
56             place-of-publication [7] ILL-String OPTIONAL,
57             publisher [8] ILL-String OPTIONAL,
58             series-title-number [9] ILL-String OPTIONAL,
59             volume-issue [10] ILL-String OPTIONAL,
60             edition [11] ILL-String OPTIONAL,
61             publication-date [12] ILL-String OPTIONAL,
62             publication-date-of-component [13] ILL-String OPTIONAL,
63             author-of-article [14] ILL-String OPTIONAL,
64             title-of-article [15] ILL-String OPTIONAL,
65             pagination [16] ILL-String OPTIONAL,
66             -- DC - 'EXTERNAL' is not currently supported
67             -- national-bibliography-no [17] EXTERNAL OPTIONAL,
68             iSBN [18] ILL-String OPTIONAL, -- (SIZE (10))
69             -- must conform to ISO 2108-1978
70             iSSN [19] ILL-String OPTIONAL, -- (SIZE (8))
71             -- must conform to ISO 3297-1986
72             -- DC - 'EXTERNAL' is not currently supported
73             -- system-no [20] EXTERNAL OPTIONAL,
74             additional-no-letters [21] ILL-String OPTIONAL,
75             verification-reference-source [22] ILL-String OPTIONAL
76             }
77              
78             =cut
79              
80             =head1 METHODS
81              
82             =cut
83              
84             #---------------------------------------------------------------
85             #
86             #---------------------------------------------------------------
87             =head1
88              
89             =head2 new( [$title [, $author [, $call-number]]] )
90              
91             Creates a new ItemId object.
92             Expects either no paramaters, or
93             a title (text string), author (text string), and/or call number (text string).
94              
95             These tend to be the most common / minimalist Item identifiers.
96              
97             Example:
98             my $iid = new Biblio::ILL::ISO::ItemId("My Book","David Christensen","CHR001.1");
99             $iid->set_item_type("monograph");
100             $iid->set_medium_type("printed");
101             $iid->set_pagination("456");
102             $iid->set_publication_date("2003");
103              
104             =cut
105             sub new {
106 2     2 1 30 my $class = shift;
107 2         4 my $self = {};
108              
109 2 50       7 if (@_) {
110 2         5 my ($title, $author, $callno) = @_;
111            
112 2 50       13 $self->{"title"} = new Biblio::ILL::ISO::ILLString($title) if ($title);
113 2 50       11 $self->{"author"} = new Biblio::ILL::ISO::ILLString($author) if ($author);
114 2 50       17 $self->{"call-number"} = new Biblio::ILL::ISO::ILLString($callno) if ($callno);
115             }
116              
117 2   33     14 bless($self, ref($class) || $class);
118 2         6 return ($self);
119             }
120              
121             #---------------------------------------------------------------
122             #
123             #---------------------------------------------------------------
124             =head1
125              
126             =head2 from_asn($href)
127              
128             Given a properly formatted hash, builds the object.
129              
130             =cut
131             sub from_asn {
132 0     0 1 0 my $self = shift;
133 0         0 my $href = shift;
134              
135 0         0 foreach my $k (keys %$href) {
136             #print ref($self) . "...$k\n";
137              
138 0 0 0     0 if ($k =~ /^item-type$/) {
    0 0        
    0 0        
      0        
      0        
      0        
      0        
      0        
      0        
      0        
      0        
      0        
      0        
      0        
      0        
      0        
      0        
      0        
139 0         0 $self->{$k} = new Biblio::ILL::ISO::ItemType();
140 0         0 $self->{$k}->from_asn($href->{$k});
141              
142             } elsif ($k =~ /^held-medium-type$/) {
143 0         0 $self->{$k} = new Biblio::ILL::ISO::MediumType();
144 0         0 $self->{$k}->from_asn($href->{$k});
145              
146             } elsif (($k =~ /^call-number$/)
147             || ($k =~ /^author$/)
148             || ($k =~ /^title$/)
149             || ($k =~ /^sub-title$/)
150             || ($k =~ /^sponsoring-body$/)
151             || ($k =~ /^place-of-publication$/)
152             || ($k =~ /^publisher$/)
153             || ($k =~ /^series-title-number$/)
154             || ($k =~ /^volume-issue$/)
155             || ($k =~ /^edition$/)
156             || ($k =~ /^publication-date$/)
157             || ($k =~ /^publication-date-of-component$/)
158             || ($k =~ /^author-of-article$/)
159             || ($k =~ /^title-of-article$/)
160             || ($k =~ /^pagination$/)
161             || ($k =~ /^iSBN$/)
162             || ($k =~ /^iSSN$/)
163             || ($k =~ /^additional-no-letters$/)
164             || ($k =~ /^verification-reference-source$/)
165             ) {
166 0         0 $self->{$k} = new Biblio::ILL::ISO::ILLString();
167 0         0 $self->{$k}->from_asn($href->{$k});
168              
169             } else {
170 0         0 croak "invalid " . ref($self) . " element: [$k]";
171             }
172              
173             }
174 0         0 return $self;
175             }
176              
177             #---------------------------------------------------------------
178             #
179             #---------------------------------------------------------------
180             =head1
181              
182             =head2 set_item_type( $itemtype )
183              
184             Sets the item's item-type.
185             Expects a valid Biblio::ILL::ISO::ItemType.
186              
187             =cut
188             sub set_item_type {
189 2     2 1 12 my $self = shift;
190 2         4 my ($s) = @_;
191            
192 2 50       18 $self->{"item-type"} = new Biblio::ILL::ISO::ItemType($s) if ($s);
193              
194 2         5 return;
195             }
196              
197             #---------------------------------------------------------------
198             #
199             #---------------------------------------------------------------
200             =head1
201              
202             =head2 set_medium_type( $mt )
203              
204             Sets the item's held-medium-type.
205             Expects a valid Biblio::ILL::ISO::MediumType.
206              
207             =cut
208             sub set_medium_type {
209 2     2 1 10 my $self = shift;
210 2         4 my ($s) = @_;
211            
212 2 50       23 $self->{"held-medium-type"} = new Biblio::ILL::ISO::MediumType($s) if ($s);
213              
214 2         6 return;
215             }
216              
217             #---------------------------------------------------------------
218             #
219             #---------------------------------------------------------------
220             =head1
221              
222             =head2 set_call_number( $s )
223              
224             Sets the item's call-number.
225             Expects a text string.
226              
227             =cut
228             sub set_call_number {
229 0     0 1 0 my $self = shift;
230 0         0 my ($s) = @_;
231            
232 0 0       0 $self->{"call-number"} = new Biblio::ILL::ISO::ILLString($s) if ($s);
233              
234 0         0 return;
235             }
236              
237             #---------------------------------------------------------------
238             #
239             #---------------------------------------------------------------
240             =head1
241              
242             =head2 set_author( $s )
243              
244             Sets the item's author.
245             Expects a text string.
246              
247             =cut
248             sub set_author {
249 0     0 1 0 my $self = shift;
250 0         0 my ($s) = @_;
251            
252 0 0       0 $self->{"author"} = new Biblio::ILL::ISO::ILLString($s) if ($s);
253              
254 0         0 return;
255             }
256              
257             #---------------------------------------------------------------
258             #
259             #---------------------------------------------------------------
260             =head1
261              
262             =head2 set_title( $s )
263              
264             Sets the item's title.
265             Expects a text string.
266              
267             =cut
268             sub set_title {
269 0     0 1 0 my $self = shift;
270 0         0 my ($s) = @_;
271            
272 0 0       0 $self->{"title"} = new Biblio::ILL::ISO::ILLString($s) if ($s);
273              
274 0         0 return;
275             }
276              
277             #---------------------------------------------------------------
278             #
279             #---------------------------------------------------------------
280             =head1
281              
282             =head2 set_subtitle( $s )
283              
284             Sets the item's sub-title.
285             Expects a text string.
286              
287             =cut
288             sub set_subtitle {
289 0     0 1 0 my $self = shift;
290 0         0 my ($s) = @_;
291            
292 0 0       0 $self->{"sub-title"} = new Biblio::ILL::ISO::ILLString($s) if ($s);
293              
294 0         0 return;
295             }
296              
297             #---------------------------------------------------------------
298             #
299             #---------------------------------------------------------------
300             =head1
301              
302             =head2 set_sponsoring_body( $s )
303              
304             Sets the item's sponsoring-body.
305             Expects a text string.
306              
307             =cut
308             sub set_sponsoring_body {
309 0     0 1 0 my $self = shift;
310 0         0 my ($s) = @_;
311            
312 0 0       0 $self->{"sponsoring-body"} = new Biblio::ILL::ISO::ILLString($s) if ($s);
313              
314 0         0 return;
315             }
316              
317             #---------------------------------------------------------------
318             #
319             #---------------------------------------------------------------
320             =head1
321              
322             =head2 set_place_of_publication( $s )
323              
324             Sets the item's place-of-publication.
325             Expects a text string.
326              
327             =cut
328             sub set_place_of_publication {
329 0     0 1 0 my $self = shift;
330 0         0 my ($s) = @_;
331            
332 0 0       0 $self->{"place-of-publication"} = new Biblio::ILL::ISO::ILLString($s) if ($s);
333              
334 0         0 return;
335             }
336              
337             #---------------------------------------------------------------
338             #
339             #---------------------------------------------------------------
340             =head1
341              
342             =head2 set_publisher( $s )
343              
344             Sets the item's publisher.
345             Expects a text string.
346              
347             =cut
348             sub set_publisher {
349 0     0 1 0 my $self = shift;
350 0         0 my ($s) = @_;
351            
352 0 0       0 $self->{"publisher"} = new Biblio::ILL::ISO::ILLString($s) if ($s);
353              
354 0         0 return;
355             }
356              
357             #---------------------------------------------------------------
358             #
359             #---------------------------------------------------------------
360             =head1
361              
362             =head2 set_series_title_number( $s )
363              
364             Sets the item's series-title-number.
365             Expects a text string.
366              
367             =cut
368             sub set_series_title_number {
369 0     0 1 0 my $self = shift;
370 0         0 my ($s) = @_;
371            
372 0 0       0 $self->{"series-title-number"} = new Biblio::ILL::ISO::ILLString($s) if ($s);
373              
374 0         0 return;
375             }
376              
377             #---------------------------------------------------------------
378             #
379             #---------------------------------------------------------------
380             =head1
381              
382             =head2 set_volume_issue( $s )
383              
384             Sets the item's volume-issue.
385             Expects a text string.
386              
387             =cut
388             sub set_volume_issue {
389 0     0 1 0 my $self = shift;
390 0         0 my ($s) = @_;
391            
392 0 0       0 $self->{"volume-issue"} = new Biblio::ILL::ISO::ILLString($s) if ($s);
393              
394 0         0 return;
395             }
396              
397             #---------------------------------------------------------------
398             #
399             #---------------------------------------------------------------
400             =head1
401              
402             =head2 set_edition( $s )
403              
404             Sets the item's edition.
405             Expects a text string.
406              
407             =cut
408             sub set_edition {
409 0     0 1 0 my $self = shift;
410 0         0 my ($s) = @_;
411            
412 0 0       0 $self->{"edition"} = new Biblio::ILL::ISO::ILLString($s) if ($s);
413              
414 0         0 return;
415             }
416              
417             #---------------------------------------------------------------
418             #
419             #---------------------------------------------------------------
420             =head1
421              
422             =head2 set_publication_date( $s )
423              
424             Sets the item's publication-date.
425             Expects a text string.
426              
427             =cut
428             sub set_publication_date {
429 2     2 1 11 my $self = shift;
430 2         4 my ($s) = @_;
431            
432 2 50       14 $self->{"publication-date"} = new Biblio::ILL::ISO::ILLString($s) if ($s);
433              
434 2         6 return;
435             }
436              
437             #---------------------------------------------------------------
438             #
439             #---------------------------------------------------------------
440             =head1
441              
442             =head2 set_publication_date_of_component( $s )
443              
444             Sets the item's publication-date-of-component.
445             Expects a text string.
446              
447             =cut
448             sub set_publication_date_of_component {
449 0     0 1 0 my $self = shift;
450 0         0 my ($s) = @_;
451            
452 0 0       0 $self->{"publication-date-of-component"} = new Biblio::ILL::ISO::ILLString($s) if ($s);
453              
454 0         0 return;
455             }
456              
457             #---------------------------------------------------------------
458             #
459             #---------------------------------------------------------------
460             =head1
461              
462             =head2 set_author_of_article( $s )
463              
464             Sets the item's author-of-article.
465             Expects a text string.
466              
467             =cut
468             sub set_author_of_article {
469 0     0 1 0 my $self = shift;
470 0         0 my ($s) = @_;
471            
472 0 0       0 $self->{"author-of-article"} = new Biblio::ILL::ISO::ILLString($s) if ($s);
473              
474 0         0 return;
475             }
476              
477             #---------------------------------------------------------------
478             #
479             #---------------------------------------------------------------
480             =head1
481              
482             =head2 set_title_of_article( $s )
483              
484             Sets the item's title-of-article.
485             Expects a text string.
486              
487             =cut
488             sub set_title_of_article {
489 0     0 1 0 my $self = shift;
490 0         0 my ($s) = @_;
491            
492 0 0       0 $self->{"title-of-article"} = new Biblio::ILL::ISO::ILLString($s) if ($s);
493              
494 0         0 return;
495             }
496              
497             #---------------------------------------------------------------
498             #
499             #---------------------------------------------------------------
500             =head1
501              
502             =head2 set_pagination( $s )
503              
504             Sets the item's pagination (page count).
505             Expects a text string.
506              
507             =cut
508             sub set_pagination {
509 2     2 1 12 my $self = shift;
510 2         5 my ($s) = @_;
511            
512 2 50       13 $self->{"pagination"} = new Biblio::ILL::ISO::ILLString($s) if ($s);
513              
514 2         6 return;
515             }
516              
517             #---------------------------------------------------------------
518             #
519             #---------------------------------------------------------------
520             =head1
521              
522             =head2 set_isbn( $s )
523              
524             Sets the item's iSBN.
525             Expects a text string.
526              
527             =cut
528             sub set_isbn {
529 0     0 1   my $self = shift;
530 0           my ($s) = @_;
531            
532 0 0         $self->{"iSBN"} = new Biblio::ILL::ISO::ILLString($s) if ($s);
533              
534 0           return;
535             }
536              
537             #---------------------------------------------------------------
538             #
539             #---------------------------------------------------------------
540             =head1
541              
542             =head2 set_issn( $s )
543              
544             Sets the item's iSSN.
545             Expects a text string.
546              
547             =cut
548             sub set_issn {
549 0     0 1   my $self = shift;
550 0           my ($s) = @_;
551            
552 0 0         $self->{"iSSN"} = new Biblio::ILL::ISO::ILLString($s) if ($s);
553              
554 0           return;
555             }
556              
557             #---------------------------------------------------------------
558             #
559             #---------------------------------------------------------------
560             =head1
561              
562             =head2 set_additional_no_letters( $s )
563              
564             Sets the item's additional-no-letters.
565             Expects a text string.
566              
567             =cut
568             sub set_additional_no_letters {
569 0     0 1   my $self = shift;
570 0           my ($s) = @_;
571            
572 0 0         $self->{"additional-no-letters"} = new Biblio::ILL::ISO::ILLString($s) if ($s);
573              
574 0           return;
575             }
576              
577             #---------------------------------------------------------------
578             #
579             #---------------------------------------------------------------
580             =head1
581              
582             =head2 set_verification_reference_source( $s )
583              
584             Sets the item's verification-reference-source.
585             Expects a text string.
586              
587             Ie - where did this ItemId information come from?
588              
589             =cut
590             sub set_verification_reference_source {
591 0     0 1   my $self = shift;
592 0           my ($s) = @_;
593            
594 0 0         $self->{"verification-reference-source"} = new Biblio::ILL::ISO::ILLString($s) if ($s);
595              
596 0           return;
597             }
598              
599             =head1 SEE ALSO
600              
601             See the README for system design notes.
602             See the parent class(es) for other available methods.
603              
604             For more information on Interlibrary Loan standards (ISO 10160/10161),
605             a good place to start is:
606              
607             http://www.nlc-bnc.ca/iso/ill/main.htm
608              
609             =cut
610              
611             =head1 AUTHOR
612              
613             David Christensen,
614              
615             =cut
616              
617              
618             =head1 COPYRIGHT AND LICENSE
619              
620             Copyright 2003 by David Christensen
621              
622             This library is free software; you can redistribute it and/or modify it
623             under the same terms as Perl itself.
624              
625             =cut
626              
627             1;