Filename | /Users/timbo/perl5/perlbrew/perls/perl-5.18.2/lib/site_perl/5.18.2/Perl/Critic/Utils/POD.pm |
Statements | Executed 26 statements in 2.46ms |
Calls | P | F | Exclusive Time |
Inclusive Time |
Subroutine |
---|---|---|---|---|---|
1 | 1 | 1 | 322µs | 1.37ms | BEGIN@22 | Perl::Critic::Utils::POD::
1 | 1 | 1 | 16µs | 16µs | BEGIN@10 | Perl::Critic::Utils::POD::
1 | 1 | 1 | 12µs | 396µs | BEGIN@23 | Perl::Critic::Utils::POD::
1 | 1 | 1 | 12µs | 20µs | BEGIN@25 | Perl::Critic::Utils::POD::
1 | 1 | 1 | 7µs | 28µs | BEGIN@21 | Perl::Critic::Utils::POD::
1 | 1 | 1 | 7µs | 11µs | BEGIN@12 | Perl::Critic::Utils::POD::
1 | 1 | 1 | 7µs | 18µs | BEGIN@11 | Perl::Critic::Utils::POD::
1 | 1 | 1 | 7µs | 362µs | BEGIN@14 | Perl::Critic::Utils::POD::
1 | 1 | 1 | 4µs | 4µs | BEGIN@16 | Perl::Critic::Utils::POD::
1 | 1 | 1 | 3µs | 3µs | BEGIN@17 | Perl::Critic::Utils::POD::
1 | 1 | 1 | 3µs | 3µs | BEGIN@18 | Perl::Critic::Utils::POD::
0 | 0 | 0 | 0s | 0s | _get_module_abstract_from_file | Perl::Critic::Utils::POD::
0 | 0 | 0 | 0s | 0s | _get_module_abstract_from_filehandle | Perl::Critic::Utils::POD::
0 | 0 | 0 | 0s | 0s | _get_module_abstract_from_string | Perl::Critic::Utils::POD::
0 | 0 | 0 | 0s | 0s | _get_pod_section_from_file | Perl::Critic::Utils::POD::
0 | 0 | 0 | 0s | 0s | _get_pod_section_from_filehandle | Perl::Critic::Utils::POD::
0 | 0 | 0 | 0s | 0s | _get_pod_section_from_string | Perl::Critic::Utils::POD::
0 | 0 | 0 | 0s | 0s | get_module_abstract_for_module | Perl::Critic::Utils::POD::
0 | 0 | 0 | 0s | 0s | get_module_abstract_from_file | Perl::Critic::Utils::POD::
0 | 0 | 0 | 0s | 0s | get_module_abstract_from_filehandle | Perl::Critic::Utils::POD::
0 | 0 | 0 | 0s | 0s | get_module_abstract_from_string | Perl::Critic::Utils::POD::
0 | 0 | 0 | 0s | 0s | get_pod_file_for_module | Perl::Critic::Utils::POD::
0 | 0 | 0 | 0s | 0s | get_pod_section_for_module | Perl::Critic::Utils::POD::
0 | 0 | 0 | 0s | 0s | get_pod_section_from_file | Perl::Critic::Utils::POD::
0 | 0 | 0 | 0s | 0s | get_pod_section_from_filehandle | Perl::Critic::Utils::POD::
0 | 0 | 0 | 0s | 0s | get_pod_section_from_string | Perl::Critic::Utils::POD::
0 | 0 | 0 | 0s | 0s | get_raw_module_abstract_for_module | Perl::Critic::Utils::POD::
0 | 0 | 0 | 0s | 0s | get_raw_module_abstract_from_file | Perl::Critic::Utils::POD::
0 | 0 | 0 | 0s | 0s | get_raw_module_abstract_from_filehandle | Perl::Critic::Utils::POD::
0 | 0 | 0 | 0s | 0s | get_raw_module_abstract_from_string | Perl::Critic::Utils::POD::
0 | 0 | 0 | 0s | 0s | get_raw_pod_section_for_module | Perl::Critic::Utils::POD::
0 | 0 | 0 | 0s | 0s | get_raw_pod_section_from_file | Perl::Critic::Utils::POD::
0 | 0 | 0 | 0s | 0s | get_raw_pod_section_from_filehandle | Perl::Critic::Utils::POD::
0 | 0 | 0 | 0s | 0s | get_raw_pod_section_from_string | Perl::Critic::Utils::POD::
0 | 0 | 0 | 0s | 0s | trim_pod_section | Perl::Critic::Utils::POD::
0 | 0 | 0 | 0s | 0s | trim_raw_pod_section | Perl::Critic::Utils::POD::
Line | State ments |
Time on line |
Calls | Time in subs |
Code |
---|---|---|---|---|---|
1 | ############################################################################## | ||||
2 | # $URL$ | ||||
3 | # $Date$ | ||||
4 | # $Author$ | ||||
5 | # $Revision$ | ||||
6 | ############################################################################## | ||||
7 | |||||
8 | package Perl::Critic::Utils::POD; | ||||
9 | |||||
10 | 2 | 43µs | 1 | 16µs | # spent 16µs within Perl::Critic::Utils::POD::BEGIN@10 which was called:
# once (16µs+0s) by Perl::Critic::Violation::BEGIN@26 at line 10 # spent 16µs making 1 call to Perl::Critic::Utils::POD::BEGIN@10 |
11 | 2 | 19µs | 2 | 30µs | # spent 18µs (7+11) within Perl::Critic::Utils::POD::BEGIN@11 which was called:
# once (7µs+11µs) by Perl::Critic::Violation::BEGIN@26 at line 11 # spent 18µs making 1 call to Perl::Critic::Utils::POD::BEGIN@11
# spent 11µs making 1 call to strict::import |
12 | 2 | 23µs | 2 | 14µs | # spent 11µs (7+4) within Perl::Critic::Utils::POD::BEGIN@12 which was called:
# once (7µs+4µs) by Perl::Critic::Violation::BEGIN@26 at line 12 # spent 11µs making 1 call to Perl::Critic::Utils::POD::BEGIN@12
# spent 4µs making 1 call to warnings::import |
13 | |||||
14 | 2 | 22µs | 2 | 718µs | # spent 362µs (7+356) within Perl::Critic::Utils::POD::BEGIN@14 which was called:
# once (7µs+356µs) by Perl::Critic::Violation::BEGIN@26 at line 14 # spent 362µs making 1 call to Perl::Critic::Utils::POD::BEGIN@14
# spent 356µs making 1 call to English::import |
15 | |||||
16 | 2 | 16µs | 1 | 4µs | # spent 4µs within Perl::Critic::Utils::POD::BEGIN@16 which was called:
# once (4µs+0s) by Perl::Critic::Violation::BEGIN@26 at line 16 # spent 4µs making 1 call to Perl::Critic::Utils::POD::BEGIN@16 |
17 | 2 | 14µs | 1 | 3µs | # spent 3µs within Perl::Critic::Utils::POD::BEGIN@17 which was called:
# once (3µs+0s) by Perl::Critic::Violation::BEGIN@26 at line 17 # spent 3µs making 1 call to Perl::Critic::Utils::POD::BEGIN@17 |
18 | 2 | 18µs | 1 | 3µs | # spent 3µs within Perl::Critic::Utils::POD::BEGIN@18 which was called:
# once (3µs+0s) by Perl::Critic::Violation::BEGIN@26 at line 18 # spent 3µs making 1 call to Perl::Critic::Utils::POD::BEGIN@18 |
19 | |||||
20 | # TODO: non-fatal generic? | ||||
21 | 2 | 20µs | 2 | 48µs | # spent 28µs (7+21) within Perl::Critic::Utils::POD::BEGIN@21 which was called:
# once (7µs+21µs) by Perl::Critic::Violation::BEGIN@26 at line 21 # spent 28µs making 1 call to Perl::Critic::Utils::POD::BEGIN@21
# spent 21µs making 1 call to Exporter::import |
22 | 2 | 153µs | 2 | 1.44ms | # spent 1.37ms (322µs+1.05) within Perl::Critic::Utils::POD::BEGIN@22 which was called:
# once (322µs+1.05ms) by Perl::Critic::Violation::BEGIN@26 at line 22 # spent 1.37ms making 1 call to Perl::Critic::Utils::POD::BEGIN@22
# spent 66µs making 1 call to Exporter::import |
23 | 2 | 41µs | 2 | 780µs | # spent 396µs (12+384) within Perl::Critic::Utils::POD::BEGIN@23 which was called:
# once (12µs+384µs) by Perl::Critic::Violation::BEGIN@26 at line 23 # spent 396µs making 1 call to Perl::Critic::Utils::POD::BEGIN@23
# spent 384µs making 1 call to Exporter::import |
24 | |||||
25 | 2 | 2.07ms | 2 | 28µs | # spent 20µs (12+8) within Perl::Critic::Utils::POD::BEGIN@25 which was called:
# once (12µs+8µs) by Perl::Critic::Violation::BEGIN@26 at line 25 # spent 20µs making 1 call to Perl::Critic::Utils::POD::BEGIN@25
# spent 8µs making 1 call to Exporter::import |
26 | |||||
27 | 1 | 1µs | our $VERSION = '1.121'; | ||
28 | |||||
29 | #----------------------------------------------------------------------------- | ||||
30 | |||||
31 | 1 | 6µs | our @EXPORT_OK = qw( | ||
32 | get_pod_file_for_module | ||||
33 | get_raw_pod_section_from_file | ||||
34 | get_raw_pod_section_from_filehandle | ||||
35 | get_raw_pod_section_from_string | ||||
36 | get_raw_pod_section_for_module | ||||
37 | get_pod_section_from_file | ||||
38 | get_pod_section_from_filehandle | ||||
39 | get_pod_section_from_string | ||||
40 | get_pod_section_for_module | ||||
41 | trim_raw_pod_section | ||||
42 | trim_pod_section | ||||
43 | get_raw_module_abstract_from_file | ||||
44 | get_raw_module_abstract_from_filehandle | ||||
45 | get_raw_module_abstract_from_string | ||||
46 | get_raw_module_abstract_for_module | ||||
47 | get_module_abstract_from_file | ||||
48 | get_module_abstract_from_filehandle | ||||
49 | get_module_abstract_from_string | ||||
50 | get_module_abstract_for_module | ||||
51 | ); | ||||
52 | |||||
53 | 1 | 2µs | our %EXPORT_TAGS = ( | ||
54 | all => \@EXPORT_OK, | ||||
55 | ); | ||||
56 | |||||
57 | #----------------------------------------------------------------------------- | ||||
58 | |||||
59 | sub get_pod_file_for_module { | ||||
60 | my ($module_name) = @_; | ||||
61 | |||||
62 | # No File::Spec: %INC always uses forward slashes. | ||||
63 | (my $relative_path = $module_name) =~ s< :: ></>xmsg; | ||||
64 | $relative_path .= '.pm'; | ||||
65 | |||||
66 | my $absolute_path = $INC{$relative_path} or return; | ||||
67 | |||||
68 | (my $pod_path = $absolute_path) =~ s< [.] [^.]+ \z><.pod>xms; | ||||
69 | return $pod_path if -f $pod_path; | ||||
70 | |||||
71 | return $absolute_path; | ||||
72 | } | ||||
73 | |||||
74 | #----------------------------------------------------------------------------- | ||||
75 | |||||
76 | sub get_raw_pod_section_from_file { | ||||
77 | my ($file_name, $section_name) = @_; | ||||
78 | |||||
79 | return _get_pod_section_from_file( | ||||
80 | $file_name, | ||||
81 | $section_name, | ||||
82 | Pod::Select->new(), | ||||
83 | ); | ||||
84 | } | ||||
85 | |||||
86 | #----------------------------------------------------------------------------- | ||||
87 | |||||
88 | sub get_raw_pod_section_from_filehandle { | ||||
89 | my ($file_handle, $section_name) = @_; | ||||
90 | |||||
91 | return _get_pod_section_from_filehandle( | ||||
92 | $file_handle, | ||||
93 | $section_name, | ||||
94 | Pod::Select->new(), | ||||
95 | ); | ||||
96 | } | ||||
97 | |||||
98 | #----------------------------------------------------------------------------- | ||||
99 | |||||
100 | sub get_raw_pod_section_from_string { | ||||
101 | my ($source, $section_name) = @_; | ||||
102 | |||||
103 | return _get_pod_section_from_string( | ||||
104 | $source, | ||||
105 | $section_name, | ||||
106 | Pod::Select->new(), | ||||
107 | ); | ||||
108 | } | ||||
109 | |||||
110 | #----------------------------------------------------------------------------- | ||||
111 | |||||
112 | sub get_raw_pod_section_for_module { | ||||
113 | my ($module_name, $section_name) = @_; | ||||
114 | |||||
115 | my $file_name = get_pod_file_for_module($module_name) | ||||
116 | or throw_generic qq<Could not find POD for "$module_name".>; | ||||
117 | |||||
118 | return get_raw_pod_section_from_file($file_name, $section_name); | ||||
119 | } | ||||
120 | |||||
121 | #----------------------------------------------------------------------------- | ||||
122 | |||||
123 | sub get_pod_section_from_file { | ||||
124 | my ($file_name, $section_name) = @_; | ||||
125 | |||||
126 | return _get_pod_section_from_file( | ||||
127 | $file_name, | ||||
128 | $section_name, | ||||
129 | Pod::PlainText->new(), | ||||
130 | ); | ||||
131 | } | ||||
132 | |||||
133 | #----------------------------------------------------------------------------- | ||||
134 | |||||
135 | sub get_pod_section_from_filehandle { | ||||
136 | my ($file_handle, $section_name) = @_; | ||||
137 | |||||
138 | return _get_pod_section_from_filehandle( | ||||
139 | $file_handle, | ||||
140 | $section_name, | ||||
141 | Pod::PlainText->new(), | ||||
142 | ); | ||||
143 | } | ||||
144 | |||||
145 | #----------------------------------------------------------------------------- | ||||
146 | |||||
147 | sub get_pod_section_from_string { | ||||
148 | my ($source, $section_name) = @_; | ||||
149 | |||||
150 | return _get_pod_section_from_string( | ||||
151 | $source, | ||||
152 | $section_name, | ||||
153 | Pod::PlainText->new(), | ||||
154 | ); | ||||
155 | } | ||||
156 | |||||
157 | #----------------------------------------------------------------------------- | ||||
158 | |||||
159 | sub get_pod_section_for_module { | ||||
160 | my ($module_name, $section_name) = @_; | ||||
161 | |||||
162 | my $file_name = get_pod_file_for_module($module_name) | ||||
163 | or throw_generic qq<Could not find POD for "$module_name".>; | ||||
164 | |||||
165 | return get_pod_section_from_file($file_name, $section_name); | ||||
166 | } | ||||
167 | |||||
168 | #----------------------------------------------------------------------------- | ||||
169 | |||||
170 | sub _get_pod_section_from_file { | ||||
171 | my ($file_name, $section_name, $parser) = @_; | ||||
172 | |||||
173 | open my $file_handle, '<', $file_name | ||||
174 | or throw_io | ||||
175 | message => qq<Could not open "$file_name": $ERRNO>, | ||||
176 | file_name => $file_name, | ||||
177 | errno => $ERRNO; | ||||
178 | |||||
179 | my $content = | ||||
180 | _get_pod_section_from_filehandle( | ||||
181 | $file_handle, $section_name, $parser, | ||||
182 | ); | ||||
183 | |||||
184 | close $file_handle | ||||
185 | or throw_io | ||||
186 | message => qq<Could not close "$file_name": $ERRNO>, | ||||
187 | file_name => $file_name, | ||||
188 | errno => $ERRNO; | ||||
189 | |||||
190 | return $content; | ||||
191 | } | ||||
192 | |||||
193 | #----------------------------------------------------------------------------- | ||||
194 | |||||
195 | sub _get_pod_section_from_filehandle { | ||||
196 | my ($file_handle, $section_name, $parser) = @_; | ||||
197 | |||||
198 | $parser->select($section_name); | ||||
199 | |||||
200 | my $content = $EMPTY; | ||||
201 | my $content_handle = IO::String->new( \$content ); | ||||
202 | |||||
203 | $parser->parse_from_filehandle( $file_handle, $content_handle ); | ||||
204 | |||||
205 | return if $content eq $EMPTY; | ||||
206 | return $content; | ||||
207 | } | ||||
208 | |||||
209 | #----------------------------------------------------------------------------- | ||||
210 | |||||
211 | sub _get_pod_section_from_string { | ||||
212 | my ($source, $section_name, $parser) = @_; | ||||
213 | |||||
214 | my $source_handle = IO::String->new( \$source ); | ||||
215 | |||||
216 | return | ||||
217 | _get_pod_section_from_filehandle( | ||||
218 | $source_handle, $section_name, $parser, | ||||
219 | ); | ||||
220 | } | ||||
221 | |||||
222 | #----------------------------------------------------------------------------- | ||||
223 | |||||
224 | sub trim_raw_pod_section { | ||||
225 | my ($pod) = @_; | ||||
226 | |||||
227 | return if not defined $pod; | ||||
228 | |||||
229 | $pod =~ s< \A =head1 \b [^\n]* \n $ ><>xms; | ||||
230 | $pod =~ s< \A \s+ ><>xms; | ||||
231 | $pod =~ s< \s+ \z ><>xms; | ||||
232 | |||||
233 | return $pod; | ||||
234 | } | ||||
235 | |||||
236 | #----------------------------------------------------------------------------- | ||||
237 | |||||
238 | sub trim_pod_section { | ||||
239 | my ($pod) = @_; | ||||
240 | |||||
241 | return if not defined $pod; | ||||
242 | |||||
243 | $pod =~ s< \A [^\n]* \n ><>xms; | ||||
244 | $pod =~ s< \A \s* \n ><>xms; | ||||
245 | $pod =~ s< \s+ \z ><>xms; | ||||
246 | |||||
247 | return $pod; | ||||
248 | } | ||||
249 | |||||
250 | #----------------------------------------------------------------------------- | ||||
251 | |||||
252 | sub get_raw_module_abstract_from_file { | ||||
253 | my ($file_name) = @_; | ||||
254 | |||||
255 | return | ||||
256 | _get_module_abstract_from_file( | ||||
257 | $file_name, | ||||
258 | Pod::Select->new(), | ||||
259 | \&trim_raw_pod_section, | ||||
260 | ); | ||||
261 | } | ||||
262 | |||||
263 | #----------------------------------------------------------------------------- | ||||
264 | |||||
265 | sub get_raw_module_abstract_from_filehandle { | ||||
266 | my ($file_handle) = @_; | ||||
267 | |||||
268 | return | ||||
269 | _get_module_abstract_from_filehandle( | ||||
270 | $file_handle, | ||||
271 | Pod::Select->new(), | ||||
272 | \&trim_raw_pod_section, | ||||
273 | ); | ||||
274 | } | ||||
275 | |||||
276 | #----------------------------------------------------------------------------- | ||||
277 | |||||
278 | sub get_raw_module_abstract_from_string { | ||||
279 | my ($source) = @_; | ||||
280 | |||||
281 | return | ||||
282 | _get_module_abstract_from_string( | ||||
283 | $source, | ||||
284 | Pod::Select->new(), | ||||
285 | \&trim_raw_pod_section, | ||||
286 | ); | ||||
287 | } | ||||
288 | |||||
289 | #----------------------------------------------------------------------------- | ||||
290 | |||||
291 | sub get_raw_module_abstract_for_module { | ||||
292 | my ($module_name) = @_; | ||||
293 | |||||
294 | my $file_name = get_pod_file_for_module($module_name) | ||||
295 | or throw_generic qq<Could not find POD for "$module_name".>; | ||||
296 | |||||
297 | return get_raw_module_abstract_from_file($file_name); | ||||
298 | } | ||||
299 | |||||
300 | #----------------------------------------------------------------------------- | ||||
301 | |||||
302 | sub get_module_abstract_from_file { | ||||
303 | my ($file_name) = @_; | ||||
304 | |||||
305 | return | ||||
306 | _get_module_abstract_from_file( | ||||
307 | $file_name, | ||||
308 | Pod::PlainText->new(), | ||||
309 | \&trim_pod_section, | ||||
310 | ); | ||||
311 | } | ||||
312 | |||||
313 | #----------------------------------------------------------------------------- | ||||
314 | |||||
315 | sub get_module_abstract_from_filehandle { | ||||
316 | my ($file_handle) = @_; | ||||
317 | |||||
318 | return | ||||
319 | _get_module_abstract_from_filehandle( | ||||
320 | $file_handle, | ||||
321 | Pod::PlainText->new(), | ||||
322 | \&trim_pod_section, | ||||
323 | ); | ||||
324 | } | ||||
325 | |||||
326 | #----------------------------------------------------------------------------- | ||||
327 | |||||
328 | sub get_module_abstract_from_string { | ||||
329 | my ($source) = @_; | ||||
330 | |||||
331 | return | ||||
332 | _get_module_abstract_from_string( | ||||
333 | $source, | ||||
334 | Pod::PlainText->new(), | ||||
335 | \&trim_pod_section, | ||||
336 | ); | ||||
337 | } | ||||
338 | |||||
339 | #----------------------------------------------------------------------------- | ||||
340 | |||||
341 | sub get_module_abstract_for_module { | ||||
342 | my ($module_name) = @_; | ||||
343 | |||||
344 | my $file_name = get_pod_file_for_module($module_name) | ||||
345 | or throw_generic qq<Could not find POD for "$module_name".>; | ||||
346 | |||||
347 | return get_module_abstract_from_file($file_name); | ||||
348 | } | ||||
349 | |||||
350 | #----------------------------------------------------------------------------- | ||||
351 | |||||
352 | sub _get_module_abstract_from_file { | ||||
353 | my ($file_name, $parser, $trimmer) = @_; | ||||
354 | |||||
355 | open my $file_handle, '<', $file_name | ||||
356 | or throw_io | ||||
357 | message => qq<Could not open "$file_name": $ERRNO>, | ||||
358 | file_name => $file_name, | ||||
359 | errno => $ERRNO; | ||||
360 | |||||
361 | my $module_abstract = | ||||
362 | _get_module_abstract_from_filehandle( | ||||
363 | $file_handle, $parser, $trimmer, | ||||
364 | ); | ||||
365 | |||||
366 | close $file_handle | ||||
367 | or throw_io | ||||
368 | message => qq<Could not close "$file_name": $ERRNO>, | ||||
369 | file_name => $file_name, | ||||
370 | errno => $ERRNO; | ||||
371 | |||||
372 | return $module_abstract; | ||||
373 | } | ||||
374 | |||||
375 | #----------------------------------------------------------------------------- | ||||
376 | |||||
377 | sub _get_module_abstract_from_filehandle { ## no critic (RequireFinalReturn) | ||||
378 | my ($file_handle, $parser, $trimmer) = @_; | ||||
379 | |||||
380 | my $name_section = | ||||
381 | _get_pod_section_from_filehandle( $file_handle, 'NAME', $parser ); | ||||
382 | return if not $name_section; | ||||
383 | |||||
384 | $name_section = $trimmer->($name_section); | ||||
385 | return if not $name_section; | ||||
386 | |||||
387 | # Testing for parser class, blech. But it's a lot simpler and it's all | ||||
388 | # hidden in the implementation. | ||||
389 | if ('Pod::Select' eq ref $parser) { | ||||
390 | if ( $name_section =~ m< \n >xms ) { | ||||
391 | throw_generic | ||||
392 | qq<Malformed NAME section in "$name_section". > | ||||
393 | . q<It must be on a single line>; | ||||
394 | } | ||||
395 | } | ||||
396 | else { | ||||
397 | $name_section =~ s< \s+ >< >xmsg; | ||||
398 | |||||
399 | # Ugh. Pod::PlainText splits up module names. | ||||
400 | if ( | ||||
401 | $name_section =~ m< | ||||
402 | \A | ||||
403 | \s* | ||||
404 | ( | ||||
405 | \w [ \w:]+ \w | ||||
406 | ) | ||||
407 | ( | ||||
408 | \s* | ||||
409 | - | ||||
410 | .* | ||||
411 | )? | ||||
412 | \z | ||||
413 | >xms | ||||
414 | ) { | ||||
415 | my ($module_name, $rest) = ($1, $2); | ||||
416 | |||||
417 | $module_name =~ s/ [ ] //xms; | ||||
418 | |||||
419 | $name_section = $module_name . ( $rest ? $rest : $EMPTY ); | ||||
420 | } | ||||
421 | } | ||||
422 | |||||
423 | if ( | ||||
424 | $name_section =~ m< | ||||
425 | \A | ||||
426 | \s* | ||||
427 | [\w:]+ # Module name. | ||||
428 | \s+ | ||||
429 | - # The required single hyphen. | ||||
430 | \s+ | ||||
431 | ( | ||||
432 | \S # At least one non-whitespace. | ||||
433 | (?: .* \S)? # Everything up to the last non-whitespace. | ||||
434 | ) | ||||
435 | \s* | ||||
436 | \z | ||||
437 | >xms | ||||
438 | ) { | ||||
439 | my $module_abstract = $1; | ||||
440 | return $module_abstract; | ||||
441 | } | ||||
442 | |||||
443 | if ( | ||||
444 | $name_section =~ m< | ||||
445 | \A | ||||
446 | \s* | ||||
447 | [\w:]+ # Module name. | ||||
448 | (?: \s* - )? # The single hyphen is now optional. | ||||
449 | \s* | ||||
450 | \z | ||||
451 | >xms | ||||
452 | ) { | ||||
453 | return; | ||||
454 | } | ||||
455 | |||||
456 | throw_generic qq<Malformed NAME section in "$name_section".>; | ||||
457 | } | ||||
458 | |||||
459 | #----------------------------------------------------------------------------- | ||||
460 | |||||
461 | sub _get_module_abstract_from_string { | ||||
462 | my ($source, $parser, $trimmer) = @_; | ||||
463 | |||||
464 | my $source_handle = IO::String->new( \$source ); | ||||
465 | |||||
466 | return | ||||
467 | _get_module_abstract_from_filehandle( | ||||
468 | $source_handle, $parser, $trimmer, | ||||
469 | ); | ||||
470 | } | ||||
471 | |||||
472 | #----------------------------------------------------------------------------- | ||||
473 | |||||
474 | 1 | 8µs | 1; | ||
475 | |||||
476 | __END__ |