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.103006
10

OVERVIEW

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

PERL VERSION

16       This library should run on perls released even a long time ago.  It
17       should work on any version of perl released in the last five years.
18
19       Although it may work on older versions of perl, no guarantee is made
20       that the minimum required version will not be increased.  The version
21       may be increased for any reason, and there is no promise that patches
22       will be accepted to lower the minimum required perl.
23

SELECTORS

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

AUTHOR

87       Ricardo SIGNES <cpan@semiotic.systems>
88
90       This software is copyright (c) 2022 by Ricardo SIGNES.
91
92       This is free software; you can redistribute it and/or modify it under
93       the same terms as the Perl 5 programming language system itself.
94
95
96
97perl v5.36.0                      2023-01-20      Pod::Elemental::Selectors(3)
Impressum