File Coverage

blib/lib/X500/DN/Marpa/RDN.pm
Criterion Covered Total %
statement 24 24 100.0
branch 4 4 100.0
condition n/a
subroutine 8 8 100.0
pod 2 2 100.0
total 38 38 100.0


line stmt bran cond sub pod time code
1             package X500::DN::Marpa::RDN;
2              
3 1     1   6 use parent 'X500::DN::Marpa';
  1         2  
  1         7  
4 1     1   57 use strict;
  1         2  
  1         21  
5 1     1   4 use warnings;
  1         2  
  1         31  
6 1     1   4 use warnings qw(FATAL utf8); # Fatalize encoding glitches.
  1         3  
  1         30  
7              
8 1     1   5 use Moo;
  1         1  
  1         6  
9              
10 1     1   256 use Want;
  1         2  
  1         226  
11              
12             our $VERSION = '1.00';
13              
14             # ------------------------------------------------
15              
16             sub getAttributeTypes
17             {
18 4     4 1 1999 my($self) = @_;
19 4         25 my(@type) = $self -> rdn_types(1);
20              
21 4 100       14 return want('LIST') ? @type : scalar @type;
22              
23             } # End of getAttributeTypes.
24              
25             # ------------------------------------------------
26              
27             sub getAttributeValue
28             {
29 4     4 1 3188 my($self, $type) = @_;
30 4         23 my(@value) = $self -> rdn_values($type);
31              
32 4 100       13 return want('LIST') ? @value : $value[0];
33              
34             } # End of getAttributeValue.
35              
36             # ------------------------------------------------
37              
38             1;
39              
40             =pod
41              
42             =encoding utf8
43              
44             =head1 NAME
45              
46             C - Backcompat module to emulate the RDN part of C
47              
48             =head1 Synopsis
49              
50             See L.
51              
52             =head1 Description
53              
54             C provides a L-based parser for parsing X.500 Relative
55             Distinguished Names.
56              
57             This module emulates the RDN parts of L.
58              
59             Actually, objects of type C are returned by
60             L, so you may not need to use this module directly at all.
61              
62             But if you do create such an object directly, you I call C<< $rdn -> parse($an_rdn) >>
63             before calling any other methods.
64              
65             See also L and L.
66              
67             =head1 Distributions
68              
69             This module is available as a Unix-style distro (*.tgz).
70              
71             See L
72             for help on unpacking and installing distros.
73              
74             =head1 Installation
75              
76             Install C as you would any C module:
77              
78             Run:
79              
80             cpanm X500::DN::Marpa
81              
82             or run:
83              
84             sudo cpan X500::DN::Marpa
85              
86             or unpack the distro, and then either:
87              
88             perl Build.PL
89             ./Build
90             ./Build test
91             sudo ./Build install
92              
93             or:
94              
95             perl Makefile.PL
96             make (or dmake or nmake)
97             make test
98             make install
99              
100             =head1 Constructor and Initialization
101              
102             C is called as C<< my($parser) = X500::DN::Marpa::RDN -> new(k1 => v1, k2 => v2, ...) >>.
103              
104             It returns a new object of type C.
105              
106             Key-value pairs accepted in the parameter list (see corresponding methods for details:
107              
108             =over 4
109              
110             =item o (None)
111              
112             =back
113              
114             =head1 Methods
115              
116             This module is a subclass of L and shares all its options to new(), and all its
117             methods. See L and L.
118              
119             Further, it has these methods:
120              
121             =head2 getAttributeTypes()
122              
123             In scalar context, returns the number of types in the RDN passed in to
124             L.
125              
126             In list context, returns all those types.
127              
128             =head2 getAttributeValue($key)
129              
130             In scalar context, returns the number of values in the RDN passed in to
131             L, whose type matches $key.
132              
133             In list context, returns all those values.
134              
135             =head2 new()
136              
137             See L for details on the parameters accepted by L.
138              
139             =head1 FAQ
140              
141             See L and L.
142              
143             =head1 References
144              
145             See L.
146              
147             =head1 See Also
148              
149             L.
150              
151             L.
152              
153             L.
154              
155             =head1 Machine-Readable Change Log
156              
157             The file Changes was converted into Changelog.ini by L.
158              
159             =head1 Version Numbers
160              
161             Version numbers < 1.00 represent development versions. From 1.00 up, they are production versions.
162              
163             =head1 Repository
164              
165             L
166              
167             =head1 Support
168              
169             Email the author, or log a bug on RT:
170              
171             L.
172              
173             =head1 Author
174              
175             L was written by Ron Savage Iron@savage.net.auE> in 2015.
176              
177             Marpa's homepage: L.
178              
179             My homepage: L.
180              
181             =head1 Copyright
182              
183             Australian copyright (c) 2015, Ron Savage.
184              
185             All Programs of mine are 'OSI Certified Open Source Software';
186             you can redistribute them and/or modify them under the terms of
187             The Artistic License 2.0, a copy of which is available at:
188             http://opensource.org/licenses/alphabetical.
189              
190             =cut