| 1 | package Biblio::ILL::ISO::PersonOrInstitutionSymbol; | ||||||||||||||||||||
| 2 | |||||||||||||||||||||
| 3 | =head1 NAME | ||||||||||||||||||||
| 4 | |||||||||||||||||||||
| 5 | Biblio::ILL::ISO::PersonOrInstitutionSymbol | ||||||||||||||||||||
| 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::ILLString; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 11 | |||||||||||||||||||||
| 12 | 4 | ▶ | use Carp; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 13 | |||||||||||||||||||||
| 14 | =head1 VERSION | ||||||||||||||||||||
| 15 | |||||||||||||||||||||
| 16 | Version 0.01 | ||||||||||||||||||||
| 17 | |||||||||||||||||||||
| 18 | =cut | ||||||||||||||||||||
| 19 | |||||||||||||||||||||
| 20 | 4 | our $VERSION = '0.01'; | |||||||||||||||||||
| 21 | #--------------------------------------------------------------------------- | ||||||||||||||||||||
| 22 | # Mods | ||||||||||||||||||||
| 23 | # 0.01 - 2003.07.15 - original version | ||||||||||||||||||||
| 24 | #--------------------------------------------------------------------------- | ||||||||||||||||||||
| 25 | |||||||||||||||||||||
| 26 | =head1 DESCRIPTION | ||||||||||||||||||||
| 27 | |||||||||||||||||||||
| 28 | Biblio::ILL::ISO::PersonOrInstitutionSymbol is a derivation of Biblio::ILL::ISO::ILLASNtype. | ||||||||||||||||||||
| 29 | |||||||||||||||||||||
| 30 | =head1 USES | ||||||||||||||||||||
| 31 | |||||||||||||||||||||
| 32 | Biblio::ILL::ISO::ILLString | ||||||||||||||||||||
| 33 | |||||||||||||||||||||
| 34 | =head1 USED IN | ||||||||||||||||||||
| 35 | |||||||||||||||||||||
| 36 | Biblio::ILL::ISO::SystemId | ||||||||||||||||||||
| 37 | |||||||||||||||||||||
| 38 | =cut | ||||||||||||||||||||
| 39 | |||||||||||||||||||||
| 40 | 4 | ▶ | BEGIN{@ISA = qw ( Biblio::ILL::ISO::ILLASNtype );} # inherit from ILLASNtype | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 41 | |||||||||||||||||||||
| 42 | =head1 FROM THE ASN DEFINITION | ||||||||||||||||||||
| 43 | |||||||||||||||||||||
| 44 | Person-Or-Institution-Symbol ::= CHOICE { | ||||||||||||||||||||
| 45 | person-symbol [0] ILL-String, | ||||||||||||||||||||
| 46 | institution-symbol [1] ILL-String | ||||||||||||||||||||
| 47 | } | ||||||||||||||||||||
| 48 | |||||||||||||||||||||
| 49 | =cut | ||||||||||||||||||||
| 50 | |||||||||||||||||||||
| 51 | =head1 METHODS | ||||||||||||||||||||
| 52 | |||||||||||||||||||||
| 53 | =cut | ||||||||||||||||||||
| 54 | #--------------------------------------------------------------- | ||||||||||||||||||||
| 55 | # | ||||||||||||||||||||
| 56 | #--------------------------------------------------------------- | ||||||||||||||||||||
| 57 | =head1 | ||||||||||||||||||||
| 58 | |||||||||||||||||||||
| 59 | =head2 new( [$institution_symbol] ) | ||||||||||||||||||||
| 60 | |||||||||||||||||||||
| 61 | Creates a new PersonOrInstitutionSymbol object. | ||||||||||||||||||||
| 62 | Expects either no paramaters, or | ||||||||||||||||||||
| 63 | an institution-symbol (text string). | ||||||||||||||||||||
| 64 | |||||||||||||||||||||
| 65 | =cut | ||||||||||||||||||||
| 66 | 60 | ▶ | sub new { | ||||||||||||||||||
|
Subroutine
new: called CC=3 SCAR=11.2
Pod
documented
| |||||||||||||||||||||
| 67 | 60 | my $class = shift; | |||||||||||||||||||
| 68 | 60 | my $self = {}; | |||||||||||||||||||
| 69 | |||||||||||||||||||||
| 70 | 60 | ▶ | if (@_) { | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 71 | 57 | $self->{"institution-symbol"} = new Biblio::ILL::ISO::ILLString(shift); | |||||||||||||||||||
| 72 | } | ||||||||||||||||||||
| 73 | 60 | ▶ | 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
| |||||||||||||||||||||
| 74 | 60 | return ($self); | |||||||||||||||||||
| 75 | } | ||||||||||||||||||||
| 76 | |||||||||||||||||||||
| 77 | |||||||||||||||||||||
| 78 | #--------------------------------------------------------------- | ||||||||||||||||||||
| 79 | # | ||||||||||||||||||||
| 80 | #--------------------------------------------------------------- | ||||||||||||||||||||
| 81 | =head1 | ||||||||||||||||||||
| 82 | |||||||||||||||||||||
| 83 | =head2 as_string( ) | ||||||||||||||||||||
| 84 | |||||||||||||||||||||
| 85 | Returns a stringified representation of the object. | ||||||||||||||||||||
| 86 | |||||||||||||||||||||
| 87 | =cut | ||||||||||||||||||||
| 88 | 0 | ▶ | sub as_string { | ||||||||||||||||||
|
Subroutine
as_string: not called CC=3 SCAR=24.8
Pod
documented
| |||||||||||||||||||||
| 89 | 0 | my $self = shift; | |||||||||||||||||||
| 90 | |||||||||||||||||||||
| 91 | 0 | ▶ | return $self->{"person-symbol"}->as_string() if ($self->{"person-symbol"}); | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 92 | 0 | ▶ | return $self->{"institution-symbol"}->as_string() if ($self->{"institution-symbol"}); | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 93 | 0 | return ""; | |||||||||||||||||||
| 94 | } | ||||||||||||||||||||
| 95 | |||||||||||||||||||||
| 96 | |||||||||||||||||||||
| 97 | #--------------------------------------------------------------- | ||||||||||||||||||||
| 98 | # | ||||||||||||||||||||
| 99 | #--------------------------------------------------------------- | ||||||||||||||||||||
| 100 | =head1 | ||||||||||||||||||||
| 101 | |||||||||||||||||||||
| 102 | =head2 from_asn($href) | ||||||||||||||||||||
| 103 | |||||||||||||||||||||
| 104 | Given a properly formatted hash, builds the object. | ||||||||||||||||||||
| 105 | |||||||||||||||||||||
| 106 | =cut | ||||||||||||||||||||
| 107 | 0 | ▶ | sub from_asn { | ||||||||||||||||||
|
Subroutine
from_asn: not called CC=4 SCAR=30.0
Pod
documented
| |||||||||||||||||||||
| 108 | 0 | my $self = shift; | |||||||||||||||||||
| 109 | 0 | my $href = shift; | |||||||||||||||||||
| 110 | |||||||||||||||||||||
| 111 | 0 | foreach my $k (keys %$href) { | |||||||||||||||||||
| 112 | #print ref($self) . "...$k\n"; | ||||||||||||||||||||
| 113 | |||||||||||||||||||||
| 114 | 0 | ▶ | if ($k =~ /^person-symbol$/) { | ||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||
| 115 | 0 | $self->{$k} = new Biblio::ILL::ISO::ILLString(); | |||||||||||||||||||
| 116 | 0 | $self->{$k}->from_asn($href->{$k}); | |||||||||||||||||||
| 117 | |||||||||||||||||||||
| 118 | } elsif ($k =~ /^institution-symbol$/) { | ||||||||||||||||||||
| 119 | 0 | $self->{$k} = new Biblio::ILL::ISO::ILLString(); | |||||||||||||||||||
| 120 | 0 | $self->{$k}->from_asn($href->{$k}); | |||||||||||||||||||
| 121 | |||||||||||||||||||||
| 122 | } else { | ||||||||||||||||||||
| 123 | 0 | croak "invalid " . ref($self) . " element: [$k]"; | |||||||||||||||||||
| 124 | } | ||||||||||||||||||||
| 125 | |||||||||||||||||||||
| 126 | } | ||||||||||||||||||||
| 127 | 0 | return $self; | |||||||||||||||||||
| 128 | } | ||||||||||||||||||||
| 129 | |||||||||||||||||||||
| 130 | #--------------------------------------------------------------- | ||||||||||||||||||||
| 131 | # | ||||||||||||||||||||
| 132 | #--------------------------------------------------------------- | ||||||||||||||||||||
| 133 | =head1 | ||||||||||||||||||||
| 134 | |||||||||||||||||||||
| 135 | =head2 set_person_symbol( $s ) | ||||||||||||||||||||
| 136 | |||||||||||||||||||||
| 137 | Sets the object's person-symbol. | ||||||||||||||||||||
| 138 | Expects a text string. | ||||||||||||||||||||
| 139 | |||||||||||||||||||||
| 140 | =cut | ||||||||||||||||||||
| 141 | 0 | ▶ | sub set_person_symbol { | ||||||||||||||||||
|
Subroutine
set_person_symbol: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||
| 142 | 0 | my $self = shift; | |||||||||||||||||||
| 143 | 0 | my ($s) = @_; | |||||||||||||||||||
| 144 | |||||||||||||||||||||
| 145 | 0 | $self->{"person-symbol"} = new Biblio::ILL::ISO::ILLString($s); | |||||||||||||||||||
| 146 | |||||||||||||||||||||
| 147 | 0 | return; | |||||||||||||||||||
| 148 | } | ||||||||||||||||||||
| 149 | |||||||||||||||||||||
| 150 | #--------------------------------------------------------------- | ||||||||||||||||||||
| 151 | # | ||||||||||||||||||||
| 152 | #--------------------------------------------------------------- | ||||||||||||||||||||
| 153 | =head1 | ||||||||||||||||||||
| 154 | |||||||||||||||||||||
| 155 | =head2 set_institution_symbol( $s ) | ||||||||||||||||||||
| 156 | |||||||||||||||||||||
| 157 | Sets the object's institution-symbol. | ||||||||||||||||||||
| 158 | Expects a text string. | ||||||||||||||||||||
| 159 | |||||||||||||||||||||
| 160 | =cut | ||||||||||||||||||||
| 161 | 3 | ▶ | sub set_institution_symbol { | ||||||||||||||||||
|
Subroutine
set_institution_symbol: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||
| 162 | 3 | my $self = shift; | |||||||||||||||||||
| 163 | 3 | my ($s) = @_; | |||||||||||||||||||
| 164 | |||||||||||||||||||||
| 165 | 3 | $self->{"institution-symbol"} = new Biblio::ILL::ISO::ILLString($s); | |||||||||||||||||||
| 166 | |||||||||||||||||||||
| 167 | 3 | return; | |||||||||||||||||||
| 168 | } | ||||||||||||||||||||
| 169 | |||||||||||||||||||||
| 170 | |||||||||||||||||||||
| 171 | 4 | 1; | |||||||||||||||||||