line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package X500::DN::Marpa::Actions; |
2
|
|
|
|
|
|
|
|
3
|
2
|
|
|
2
|
|
11
|
use strict; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
70
|
|
4
|
2
|
|
|
2
|
|
9
|
use utf8; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
20
|
|
5
|
2
|
|
|
2
|
|
44
|
use warnings; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
66
|
|
6
|
2
|
|
|
2
|
|
9
|
use warnings qw(FATAL utf8); # Fatalize encoding glitches. |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
791
|
|
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
our $VERSION = '1.00'; |
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
# ------------------------------------------------ |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
sub attribute_type |
13
|
|
|
|
|
|
|
{ |
14
|
66
|
|
|
66
|
1
|
382826
|
my($self, $t) = @_; |
15
|
66
|
|
50
|
|
|
272
|
$t = lc decode_result($t || ''); |
16
|
66
|
|
|
|
|
606
|
my(%descriptors) = |
17
|
|
|
|
|
|
|
( |
18
|
|
|
|
|
|
|
commonname => 'cn', |
19
|
|
|
|
|
|
|
countryname => 'c', |
20
|
|
|
|
|
|
|
domaincomponent => 'dc', |
21
|
|
|
|
|
|
|
localityname => 'l', |
22
|
|
|
|
|
|
|
organizationalunitname => 'ou', |
23
|
|
|
|
|
|
|
organizationname => 'o', |
24
|
|
|
|
|
|
|
stateorprovincename => 'st', |
25
|
|
|
|
|
|
|
streetaddress => 'street', |
26
|
|
|
|
|
|
|
userid => 'uid', |
27
|
|
|
|
|
|
|
); |
28
|
66
|
50
|
|
|
|
169
|
$t = $descriptors{$t} ? $descriptors{$t} : $t; |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
return |
31
|
|
|
|
|
|
|
{ |
32
|
66
|
|
|
|
|
458
|
type => 'type', |
33
|
|
|
|
|
|
|
value => $t, |
34
|
|
|
|
|
|
|
}; |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
} # End of attribute_type. |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
# ------------------------------------------------ |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
sub attribute_value |
41
|
|
|
|
|
|
|
{ |
42
|
66
|
|
|
66
|
1
|
3018
|
my($self, $t) = @_; |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
return |
45
|
|
|
|
|
|
|
{ |
46
|
66
|
100
|
|
|
|
207
|
type => 'value', |
47
|
|
|
|
|
|
|
value => defined($t) ? decode_result($t) : '', |
48
|
|
|
|
|
|
|
}; |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
} # End of attribute_value. |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
# ------------------------------------------------ |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
sub decode_result |
55
|
|
|
|
|
|
|
{ |
56
|
130
|
|
|
130
|
1
|
198
|
my($result) = @_; |
57
|
130
|
|
|
|
|
258
|
my(@worklist) = $result; |
58
|
|
|
|
|
|
|
|
59
|
130
|
|
|
|
|
172
|
my($obj); |
60
|
|
|
|
|
|
|
my($ref_type); |
61
|
0
|
|
|
|
|
0
|
my(@stack); |
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
do |
64
|
130
|
|
|
|
|
167
|
{ |
65
|
1349
|
|
|
|
|
1880
|
$obj = shift @worklist; |
66
|
1349
|
|
|
|
|
1926
|
$ref_type = ref $obj; |
67
|
|
|
|
|
|
|
|
68
|
1349
|
100
|
|
|
|
3058
|
if ($ref_type eq 'ARRAY') |
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
69
|
|
|
|
|
|
|
{ |
70
|
841
|
|
|
|
|
2445
|
unshift @worklist, @$obj; |
71
|
|
|
|
|
|
|
} |
72
|
|
|
|
|
|
|
elsif ($ref_type eq 'HASH') |
73
|
|
|
|
|
|
|
{ |
74
|
0
|
|
|
|
|
0
|
push @stack, {%$obj}; |
75
|
|
|
|
|
|
|
} |
76
|
|
|
|
|
|
|
elsif ($ref_type) |
77
|
|
|
|
|
|
|
{ |
78
|
0
|
|
|
|
|
0
|
die "Unsupported object type $ref_type\n"; |
79
|
|
|
|
|
|
|
} |
80
|
|
|
|
|
|
|
else |
81
|
|
|
|
|
|
|
{ |
82
|
508
|
|
|
|
|
1570
|
push @stack, $obj; |
83
|
|
|
|
|
|
|
} |
84
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
} while (@worklist); |
86
|
|
|
|
|
|
|
|
87
|
130
|
|
|
|
|
654
|
return join('', @stack); |
88
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
} # End of decode_result. |
90
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
# ------------------------------------------------ |
92
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
1; |
94
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
=pod |
96
|
|
|
|
|
|
|
|
97
|
|
|
|
|
|
|
=head1 NAME |
98
|
|
|
|
|
|
|
|
99
|
|
|
|
|
|
|
C - Methods triggered by 'action' clauses in the grammar |
100
|
|
|
|
|
|
|
|
101
|
|
|
|
|
|
|
=head1 Synopsis |
102
|
|
|
|
|
|
|
|
103
|
|
|
|
|
|
|
See L. |
104
|
|
|
|
|
|
|
|
105
|
|
|
|
|
|
|
=head1 Description |
106
|
|
|
|
|
|
|
|
107
|
|
|
|
|
|
|
C provides a wrapper for actions which are called by Marpa as it |
108
|
|
|
|
|
|
|
processes the grammar declared in L. |
109
|
|
|
|
|
|
|
|
110
|
|
|
|
|
|
|
End users will never call methods in this module. |
111
|
|
|
|
|
|
|
|
112
|
|
|
|
|
|
|
See instead L. |
113
|
|
|
|
|
|
|
|
114
|
|
|
|
|
|
|
=head1 Distributions |
115
|
|
|
|
|
|
|
|
116
|
|
|
|
|
|
|
This module is available as a Unix-style distro (*.tgz). |
117
|
|
|
|
|
|
|
|
118
|
|
|
|
|
|
|
See L |
119
|
|
|
|
|
|
|
for help on unpacking and installing distros. |
120
|
|
|
|
|
|
|
|
121
|
|
|
|
|
|
|
=head1 Installation |
122
|
|
|
|
|
|
|
|
123
|
|
|
|
|
|
|
Install C as you would any C module: |
124
|
|
|
|
|
|
|
|
125
|
|
|
|
|
|
|
Run: |
126
|
|
|
|
|
|
|
|
127
|
|
|
|
|
|
|
cpanm X500::DN::Marpa |
128
|
|
|
|
|
|
|
|
129
|
|
|
|
|
|
|
or run: |
130
|
|
|
|
|
|
|
|
131
|
|
|
|
|
|
|
sudo cpan X500::DN::Marpa |
132
|
|
|
|
|
|
|
|
133
|
|
|
|
|
|
|
or unpack the distro, and then either: |
134
|
|
|
|
|
|
|
|
135
|
|
|
|
|
|
|
perl Build.PL |
136
|
|
|
|
|
|
|
./Build |
137
|
|
|
|
|
|
|
./Build test |
138
|
|
|
|
|
|
|
sudo ./Build install |
139
|
|
|
|
|
|
|
|
140
|
|
|
|
|
|
|
or: |
141
|
|
|
|
|
|
|
|
142
|
|
|
|
|
|
|
perl Makefile.PL |
143
|
|
|
|
|
|
|
make (or dmake or nmake) |
144
|
|
|
|
|
|
|
make test |
145
|
|
|
|
|
|
|
make install |
146
|
|
|
|
|
|
|
|
147
|
|
|
|
|
|
|
=head1 Methods |
148
|
|
|
|
|
|
|
|
149
|
|
|
|
|
|
|
=head2 attribute_type($t) |
150
|
|
|
|
|
|
|
|
151
|
|
|
|
|
|
|
For a DN such as 'UID=12345, OU=Engineering, CN=Kurt Zeilenga+L=Redwood Shores', returns the |
152
|
|
|
|
|
|
|
lower-case version of the attribute type, e.g. 'uid'. |
153
|
|
|
|
|
|
|
|
154
|
|
|
|
|
|
|
Where the type is a standard long form, e.g. 'OrganizationalUnitName', returns the corresponding |
155
|
|
|
|
|
|
|
abbreviation, here 'ou'. |
156
|
|
|
|
|
|
|
|
157
|
|
|
|
|
|
|
=head2 attribute_value($t) |
158
|
|
|
|
|
|
|
|
159
|
|
|
|
|
|
|
For a DN such as 'UID=12345, OU=Engineering, CN=Kurt Zeilenga+L=Redwood Shores', returns the |
160
|
|
|
|
|
|
|
original-case version of the attribute value, e.g. 'Engineering'. |
161
|
|
|
|
|
|
|
|
162
|
|
|
|
|
|
|
=head1 Functions |
163
|
|
|
|
|
|
|
|
164
|
|
|
|
|
|
|
=head2 decode_result($result) |
165
|
|
|
|
|
|
|
|
166
|
|
|
|
|
|
|
Returns a string. |
167
|
|
|
|
|
|
|
|
168
|
|
|
|
|
|
|
Processes the $result passed by Marpa to both L and L, |
169
|
|
|
|
|
|
|
which will be a structure of arbitrarily nested scalars, hashrefs and arrayrefs. |
170
|
|
|
|
|
|
|
|
171
|
|
|
|
|
|
|
=head1 Machine-Readable Change Log |
172
|
|
|
|
|
|
|
|
173
|
|
|
|
|
|
|
The file Changes was converted into Changelog.ini by L. |
174
|
|
|
|
|
|
|
|
175
|
|
|
|
|
|
|
=head1 Version Numbers |
176
|
|
|
|
|
|
|
|
177
|
|
|
|
|
|
|
Version numbers < 1.00 represent development versions. From 1.00 up, they are production versions. |
178
|
|
|
|
|
|
|
|
179
|
|
|
|
|
|
|
=head1 Repository |
180
|
|
|
|
|
|
|
|
181
|
|
|
|
|
|
|
L |
182
|
|
|
|
|
|
|
|
183
|
|
|
|
|
|
|
=head1 Support |
184
|
|
|
|
|
|
|
|
185
|
|
|
|
|
|
|
Email the author, or log a bug on RT: |
186
|
|
|
|
|
|
|
|
187
|
|
|
|
|
|
|
L. |
188
|
|
|
|
|
|
|
|
189
|
|
|
|
|
|
|
=head1 Author |
190
|
|
|
|
|
|
|
|
191
|
|
|
|
|
|
|
L was written by Ron Savage Iron@savage.net.auE> in 2015. |
192
|
|
|
|
|
|
|
|
193
|
|
|
|
|
|
|
Marpa's homepage: L. |
194
|
|
|
|
|
|
|
|
195
|
|
|
|
|
|
|
My homepage: L. |
196
|
|
|
|
|
|
|
|
197
|
|
|
|
|
|
|
=head1 Copyright |
198
|
|
|
|
|
|
|
|
199
|
|
|
|
|
|
|
Australian copyright (c) 2015, Ron Savage. |
200
|
|
|
|
|
|
|
|
201
|
|
|
|
|
|
|
All Programs of mine are 'OSI Certified Open Source Software'; |
202
|
|
|
|
|
|
|
you can redistribute them and/or modify them under the terms of |
203
|
|
|
|
|
|
|
The Artistic License 2.0, a copy of which is available at: |
204
|
|
|
|
|
|
|
http://opensource.org/licenses/alphabetical. |
205
|
|
|
|
|
|
|
|
206
|
|
|
|
|
|
|
=cut |