line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Biblio::ILL::ISO::ILLASNtype; |
2
|
|
|
|
|
|
|
|
3
|
4
|
|
|
4
|
|
35817
|
use Carp; |
|
4
|
|
|
|
|
10
|
|
|
4
|
|
|
|
|
4142
|
|
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
our $VERSION = '0.01'; |
6
|
|
|
|
|
|
|
#--------------------------------------------------------------------------- |
7
|
|
|
|
|
|
|
# Mods |
8
|
|
|
|
|
|
|
# 0.01 - 2003.07.15 - original version |
9
|
|
|
|
|
|
|
#--------------------------------------------------------------------------- |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
# From the ASN |
12
|
|
|
|
|
|
|
# |
13
|
|
|
|
|
|
|
# |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
#--------------------------------------------------------------- |
17
|
|
|
|
|
|
|
# |
18
|
|
|
|
|
|
|
#--------------------------------------------------------------- |
19
|
|
|
|
|
|
|
sub new { |
20
|
0
|
|
|
0
|
0
|
0
|
my $class = shift; |
21
|
0
|
|
|
|
|
0
|
my $self = {}; |
22
|
|
|
|
|
|
|
|
23
|
0
|
|
0
|
|
|
0
|
bless($self, ref($class) || $class); |
24
|
0
|
|
|
|
|
0
|
return ($self); |
25
|
|
|
|
|
|
|
} |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
#--------------------------------------------------------------- |
29
|
|
|
|
|
|
|
# |
30
|
|
|
|
|
|
|
#--------------------------------------------------------------- |
31
|
|
|
|
|
|
|
sub as_string { |
32
|
0
|
|
|
0
|
0
|
0
|
my $self = shift; |
33
|
|
|
|
|
|
|
|
34
|
0
|
|
|
|
|
0
|
return "ILLASNtype as_string().... should be virtual!"; |
35
|
|
|
|
|
|
|
} |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
#--------------------------------------------------------------- |
38
|
|
|
|
|
|
|
# |
39
|
|
|
|
|
|
|
#--------------------------------------------------------------- |
40
|
|
|
|
|
|
|
sub as_pretty_string { |
41
|
0
|
|
|
0
|
0
|
0
|
my $self = shift; |
42
|
|
|
|
|
|
|
|
43
|
0
|
|
|
|
|
0
|
return _debug_print($self,4); |
44
|
|
|
|
|
|
|
} |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
#--------------------------------------------------------------- |
47
|
|
|
|
|
|
|
# This will return a structure usable by Convert::ASN1 |
48
|
|
|
|
|
|
|
#--------------------------------------------------------------- |
49
|
|
|
|
|
|
|
sub as_asn { |
50
|
483
|
|
|
483
|
0
|
529
|
my $self = shift; |
51
|
|
|
|
|
|
|
|
52
|
483
|
|
|
|
|
668
|
my %h = (); |
53
|
|
|
|
|
|
|
|
54
|
483
|
|
|
|
|
1287
|
foreach my $key (sort keys %$self) { |
55
|
|
|
|
|
|
|
#print " [$key]\n"; |
56
|
675
|
100
|
|
|
|
1389
|
if ( not ref($self->{$key}) ) { |
57
|
214
|
|
|
|
|
595
|
$h{$key} = $self->{$key}; |
58
|
|
|
|
|
|
|
#print " " . $h{$key} . "\n"; |
59
|
|
|
|
|
|
|
} else { |
60
|
461
|
|
|
|
|
1168
|
$h{$key} = $self->{$key}->as_asn(); |
61
|
|
|
|
|
|
|
} |
62
|
|
|
|
|
|
|
} |
63
|
|
|
|
|
|
|
|
64
|
483
|
|
|
|
|
1578
|
return \%h; |
65
|
|
|
|
|
|
|
} |
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
#--------------------------------------------------------------- |
68
|
|
|
|
|
|
|
# |
69
|
|
|
|
|
|
|
#--------------------------------------------------------------- |
70
|
|
|
|
|
|
|
sub from_asn { |
71
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
72
|
0
|
|
|
|
|
|
my $href = shift; |
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
# does nothing |
75
|
|
|
|
|
|
|
|
76
|
0
|
|
|
|
|
|
return $self; |
77
|
|
|
|
|
|
|
} |
78
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
#--------------------------------------------------------------- |
81
|
|
|
|
|
|
|
# |
82
|
|
|
|
|
|
|
#--------------------------------------------------------------- |
83
|
|
|
|
|
|
|
sub _debug_print { |
84
|
|
|
|
|
|
|
# my $self = shift; |
85
|
0
|
|
|
0
|
|
|
my ($ref, $indent) = @_; |
86
|
0
|
|
|
|
|
|
my $s = ""; |
87
|
0
|
0
|
|
|
|
|
$indent = 0 if (not defined($indent)); |
88
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
# return _debug_print_hash($self) if (not defined $ref); |
90
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
# print ">>>" . ref($ref) . "<<<\n"; |
92
|
|
|
|
|
|
|
|
93
|
0
|
0
|
|
|
|
|
return _debug_print_hash($ref, $indent) if (ref($ref) eq "HASH"); |
94
|
0
|
0
|
|
|
|
|
return _debug_print_array($ref, $indent) if (ref($ref) eq "ARRAY"); |
95
|
|
|
|
|
|
|
|
96
|
0
|
|
|
|
|
|
for ($i=0; $i < $indent; $i++) { |
97
|
0
|
|
|
|
|
|
$s .= " "; |
98
|
|
|
|
|
|
|
#print "."; # DC - debugging |
99
|
|
|
|
|
|
|
} |
100
|
|
|
|
|
|
|
#print "\n"; # DC - debugging |
101
|
|
|
|
|
|
|
|
102
|
0
|
0
|
|
|
|
|
return ("$s$ref\n") if (not ref($ref)); |
103
|
|
|
|
|
|
|
|
104
|
|
|
|
|
|
|
# If it's not any of the above, it is (should be?) an object, |
105
|
|
|
|
|
|
|
# which we treat as a hash. Cheezy, I know - I can't think |
106
|
|
|
|
|
|
|
# of a better way. |
107
|
0
|
|
|
|
|
|
return _debug_print_hash($ref, $indent); |
108
|
|
|
|
|
|
|
} |
109
|
|
|
|
|
|
|
|
110
|
|
|
|
|
|
|
|
111
|
|
|
|
|
|
|
#--------------------------------------------------------------- |
112
|
|
|
|
|
|
|
# |
113
|
|
|
|
|
|
|
#--------------------------------------------------------------- |
114
|
|
|
|
|
|
|
sub _debug_print_hash { |
115
|
0
|
|
|
0
|
|
|
my ($href, $indent) = @_; |
116
|
0
|
|
|
|
|
|
my $s = ""; |
117
|
0
|
0
|
|
|
|
|
$indent = 0 if (not defined($indent)); |
118
|
|
|
|
|
|
|
|
119
|
0
|
|
|
|
|
|
foreach $key (sort keys %$href) { |
120
|
|
|
|
|
|
|
# There's got to be a better way :-) |
121
|
0
|
|
|
|
|
|
for ($i=0; $i < $indent; $i++) { |
122
|
0
|
|
|
|
|
|
$s .= " "; |
123
|
|
|
|
|
|
|
#print "."; # DC - debugging |
124
|
|
|
|
|
|
|
} |
125
|
|
|
|
|
|
|
#print "\n"; # DC - debugging |
126
|
|
|
|
|
|
|
|
127
|
0
|
|
|
|
|
|
$s .= "$key "; |
128
|
0
|
0
|
|
|
|
|
$s .= "=>\n" unless (ref($href->{$key}) eq "HASH"); |
129
|
0
|
0
|
|
|
|
|
$s .= "\n" if (ref($href->{$key}) eq "HASH"); |
130
|
0
|
0
|
|
|
|
|
$s .= "\n" if (ref($href->{$key}) eq "ARRAY"); |
131
|
0
|
|
|
|
|
|
$s .= _debug_print($href->{$key}, $indent+4); |
132
|
|
|
|
|
|
|
} |
133
|
0
|
|
|
|
|
|
return $s; |
134
|
|
|
|
|
|
|
} |
135
|
|
|
|
|
|
|
|
136
|
|
|
|
|
|
|
|
137
|
|
|
|
|
|
|
#--------------------------------------------------------------- |
138
|
|
|
|
|
|
|
# |
139
|
|
|
|
|
|
|
#--------------------------------------------------------------- |
140
|
|
|
|
|
|
|
sub _debug_print_array { |
141
|
0
|
|
|
0
|
|
|
my ($aref, $indent) = @_; |
142
|
0
|
|
|
|
|
|
my $s = ""; |
143
|
0
|
0
|
|
|
|
|
$indent = 0 if (not defined($indent)); |
144
|
|
|
|
|
|
|
|
145
|
0
|
|
|
|
|
|
foreach $elm (@$aref) { |
146
|
|
|
|
|
|
|
# There's got to be a better way :-) |
147
|
0
|
|
|
|
|
|
for ($i=0; $i < $indent; $i++) { |
148
|
0
|
|
|
|
|
|
$s .= " "; |
149
|
|
|
|
|
|
|
#print "."; # DC - debugging |
150
|
|
|
|
|
|
|
} |
151
|
|
|
|
|
|
|
#print "\n"; # DC - debugging |
152
|
0
|
|
|
|
|
|
$s .= _debug_print($elm, $indent+4); |
153
|
|
|
|
|
|
|
} |
154
|
0
|
|
|
|
|
|
return $s; |
155
|
|
|
|
|
|
|
} |
156
|
|
|
|
|
|
|
|
157
|
|
|
|
|
|
|
1; |
158
|
|
|
|
|
|
|
|
159
|
|
|
|
|
|
|
|
160
|
|
|
|
|
|
|
|