File Coverage

blib/lib/Biblio/ILL/ISO/StateTransitionProhibited.pm
Criterion Covered Total %
statement 25 44 56.8
branch 5 22 22.7
condition 1 3 33.3
subroutine 6 8 75.0
pod 3 3 100.0
total 40 80 50.0


line stmt bran cond sub pod time code
1             package Biblio::ILL::ISO::StateTransitionProhibited;
2              
3             =head1 NAME
4              
5             Biblio::ILL::ISO::StateTransitionProhibited
6              
7             =cut
8              
9 4     4   31 use Biblio::ILL::ISO::ILLASNtype;
  4         9  
  4         167  
10 4     4   2437 use Biblio::ILL::ISO::ILLAPDUtype;
  4         10  
  4         135  
11 4     4   28 use Biblio::ILL::ISO::CurrentState;
  4         10  
  4         87  
12              
13 4     4   23 use Carp;
  4         6  
  4         346  
14              
15             =head1 VERSION
16              
17             Version 0.01
18              
19             =cut
20              
21             our $VERSION = '0.01';
22             #---------------------------------------------------------------------------
23             # Mods
24             # 0.01 - 2003.08.12 - original version
25             #---------------------------------------------------------------------------
26              
27             =head1 DESCRIPTION
28              
29             Biblio::ILL::ISO::StateTransitionProhibited is a derivation of Biblio::ILL::ISO::ILLASNtype.
30              
31             =head1 USES
32              
33             Biblio::ILL::ISO::ILLAPDUtype
34             Biblio::ILL::ISO::CurrentState
35              
36             =head1 USED IN
37              
38             Biblio::ILL::ISO::ProviderErrorReport
39              
40             =cut
41              
42 4     4   2046 BEGIN{@ISA = qw ( Biblio::ILL::ISO::ILLASNtype );} # inherit from ILLASNtype
43              
44             =head1 FROM THE ASN DEFINITION
45            
46             State-Transition-Prohibited ::= EXPLICIT SEQUENCE {
47             aPDU-type [0] IMPLICIT ILL-APDU-Type,
48             current-state [1] IMPLICIT Current-State
49             }
50              
51             =cut
52              
53             =head1 METHODS
54              
55             =cut
56              
57             #---------------------------------------------------------------
58             #
59             #---------------------------------------------------------------
60             =head1
61              
62             =head2 new( $APDUtype, $current_state )
63              
64             Creates a new StateTransitionProhibited object.
65             Expects an APDU-type (Biblio::ILL::ISO::ILLAPDUtype), and
66             the current state (Biblio::ILL::ISO::CurrentState).
67              
68             =cut
69             sub new {
70 1     1 1 9 my $class = shift;
71 1         1 my $self = {};
72              
73 1 50       3 if (@_) {
74 1         1 my ($itype, $cs) = @_;
75            
76 1 50       8 croak "missing aPDU-type" unless ($itype);
77 1 50       3 croak "invalid aPDU-type" unless (ref($itype) eq "Biblio::ILL::ISO::ILLAPDUtype");
78 1 50       2 croak "missing current-state" unless ($cs);
79 1 50       2 croak "invalid current-state" unless (ref($cs) eq "Biblio::ILL::ISO::CurrentState");
80              
81 1         2 $self->{"aPDU-type"} = $itype;
82 1         2 $self->{"current-state"} = $cs;
83             }
84              
85 1   33     4 bless($self, ref($class) || $class);
86 1         3 return ($self);
87             }
88              
89              
90             #---------------------------------------------------------------
91             #
92             #---------------------------------------------------------------
93             =head1
94              
95             =head2 set( $APDUtype, $current_state )
96              
97             Sets the object's aPDU-type (Biblio::ILL::ISO::ILLAPDUtype), and
98             current-state (Biblio::ILL::ISO::CurrentState).
99              
100             =cut
101             sub set {
102 0     0 1   my $self = shift;
103 0           my ($itype, $cs) = @_;
104            
105 0 0         croak "missing aPDU-type" unless ($itype);
106 0 0         croak "invalid aPDU-type" unless (ref($itype) eq "Biblio::ILL::ISO::ILLAPDUtype");
107 0 0         croak "missing current-state" unless ($cs);
108 0 0         croak "invalid current-state" unless (ref($cs) eq "Biblio::ILL::ISO::CurrentState");
109            
110 0           $self->{"aPDU-type"} = $itype;
111 0           $self->{"current-state"} = $cs;
112            
113 0           return;
114             }
115              
116              
117             #---------------------------------------------------------------
118             #
119             #---------------------------------------------------------------
120             =head1
121              
122             =head2 from_asn($href)
123              
124             Given a properly formatted hash, builds the object.
125              
126             =cut
127             sub from_asn {
128 0     0 1   my $self = shift;
129 0           my $href = shift;
130              
131 0           foreach my $k (keys %$href) {
132             #print ref($self) . "...$k\n";
133              
134 0 0         if ($k =~ /^aPDU-type$/) {
    0          
135 0           $self->{$k} = new Biblio::ILL::ISO::ILLAPDUType();
136 0           $self->{$k}->from_asn($href->{$k});
137              
138             } elsif ($k =~ /^current-state$/) {
139 0           $self->{$k} = new Biblio::ILL::ISO::CurrentState();
140 0           $self->{$k}->from_asn($href->{$k});
141              
142             } else {
143 0           croak "invalid " . ref($self) . " element: [$k]";
144             }
145              
146             }
147 0           return $self;
148             }
149              
150             =head1 SEE ALSO
151              
152             See the README for system design notes.
153             See the parent class(es) for other available methods.
154              
155             For more information on Interlibrary Loan standards (ISO 10160/10161),
156             a good place to start is:
157              
158             http://www.nlc-bnc.ca/iso/ill/main.htm
159              
160             =cut
161              
162             =head1 AUTHOR
163              
164             David Christensen,
165              
166             =cut
167              
168              
169             =head1 COPYRIGHT AND LICENSE
170              
171             Copyright 2003 by David Christensen
172              
173             This library is free software; you can redistribute it and/or modify it
174             under the same terms as Perl itself.
175              
176             =cut
177              
178             1;