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