1Pod::Elemental::SelectoUrsse(r3)Contributed Perl DocumenPtoadt:i:oEnlemental::Selectors(3)
2
3
4

NAME

6       Pod::Elemental::Selectors - predicates for selecting elements
7

VERSION

9       version 0.103005
10

OVERVIEW

12       Pod::Elemental::Selectors provides a number of routines to check for
13       Pod::Elemental paragraphs with given qualities.
14

SELECTORS

16       Selectors are predicates:  they examine paragraphs and return either
17       true or false.  All the selectors have (by default) names like:
18       "s_whatever".  They expect zero or more parameters to affect the
19       selection.  If these parameters are given, but no paragraph, a callback
20       will be returned that will expect a paragraph.  If a paragraph is
21       given, the selector will return immediately.
22
23       For example, the "s_command" selector expects a parameter that can be
24       the name of the command desired.  Both of the following uses are valid:
25
26         # create and use a callback:
27
28         my $selector = s_command('head1');
29         my @headers  = grep { $selector->($_) } @paragraphs;
30
31         # just check a paragraph right now:
32
33         if ( s_command('head1', $paragraph) ) { ... }
34
35       The selectors can be imported individually or as the "-all" group, and
36       can be renamed with Sub::Exporter features.  (Selectors cannot yet be
37       curried by Sub::Exporter.)
38
39   s_blank
40         my $callback = s_blank;
41
42         if( s_blank($para) ) { ... }
43
44       "s_blank" tests whether a paragraph is a Generic::Blank element.
45
46   s_flat
47         my $callback = s_flat;
48
49         if( s_flat($para) ) { ... }
50
51       "s_flat" tests whether a paragraph does Pod::Elemental::Flat -- in
52       other words, is content-only.
53
54   s_node
55         my $callback = s_node;
56
57         if( s_node($para) ) { ... }
58
59       "s_node" tests whether a paragraph does Pod::Elemental::Node -- in
60       other words, whether it may have children.
61
62   s_command
63         my $callback = s_command;
64         my $callback = s_command( $command_name);
65         my $callback = s_command(\@command_names);
66
67         if( s_command(undef, \$para) ) { ... }
68
69         if( s_command( $command_name,  \$para) ) { ... }
70         if( s_command(\@command_names, \$para) ) { ... }
71
72       "s_command" tests whether a paragraph does Pod::Elemental::Command.  If
73       a command name (or a reference to an array of command names) is given,
74       the tested paragraph's command must match one of the given command
75       names.
76

AUTHOR

78       Ricardo SIGNES <rjbs@cpan.org>
79
81       This software is copyright (c) 2020 by Ricardo SIGNES.
82
83       This is free software; you can redistribute it and/or modify it under
84       the same terms as the Perl 5 programming language system itself.
85
86
87
88perl v5.32.1                      2021-01-27      Pod::Elemental::Selectors(3)
Impressum