.\" Automatically generated by Pod::Man 4.11 (Pod::Simple 3.35) .\" .\" Standard preamble: .\" ======================================================================== .de Sp \" Vertical space (when we can't use .PP) .if t .sp .5v .if n .sp .. .de Vb \" Begin verbatim text .ft CW .nf .ne \\$1 .. .de Ve \" End verbatim text .ft R .fi .. .\" Set up some character translations and predefined strings. \*(-- will .\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left .\" double quote, and \*(R" will give a right double quote. \*(C+ will .\" give a nicer C++. Capital omega is used to do unbreakable dashes and .\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff, .\" nothing in troff, for use with C<>. .tr \(*W- .ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p' .ie n \{\ . ds -- \(*W- . ds PI pi . if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch . if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch . ds L" "" . ds R" "" . ds C` "" . ds C' "" 'br\} .el\{\ . ds -- \|\(em\| . ds PI \(*p . ds L" `` . ds R" '' . ds C` . ds C' 'br\} .\" .\" Escape single quotes in literal strings from groff's Unicode transform. .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" .\" If the F register is >0, we'll generate index entries on stderr for .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index .\" entries marked with X<> in POD. Of course, you'll have to process the .\" output yourself in some meaningful fashion. .\" .\" Avoid warning from groff about undefined register 'F'. .de IX .. .nr rF 0 .if \n(.g .if rF .nr rF 1 .if (\n(rF:(\n(.g==0)) \{\ . if \nF \{\ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . if !\nF==2 \{\ . nr % 0 . nr F 2 . \} . \} .\} .rr rF .\" ======================================================================== .\" .IX Title "Pod::Elemental::Selectors 3pm" .TH Pod::Elemental::Selectors 3pm "2020-01-25" "perl v5.30.0" "User Contributed Perl Documentation" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l .nh .SH "NAME" Pod::Elemental::Selectors \- predicates for selecting elements .SH "VERSION" .IX Header "VERSION" version 0.103005 .SH "OVERVIEW" .IX Header "OVERVIEW" Pod::Elemental::Selectors provides a number of routines to check for Pod::Elemental paragraphs with given qualities. .SH "SELECTORS" .IX Header "SELECTORS" Selectors are predicates: they examine paragraphs and return either true or false. All the selectors have (by default) names like: \f(CW\*(C`s_whatever\*(C'\fR. They expect zero or more parameters to affect the selection. If these parameters are given, but no paragraph, a callback will be returned that will expect a paragraph. If a paragraph is given, the selector will return immediately. .PP For example, the \f(CW\*(C`s_command\*(C'\fR selector expects a parameter that can be the name of the command desired. Both of the following uses are valid: .PP .Vb 1 \& # create and use a callback: \& \& my $selector = s_command(\*(Aqhead1\*(Aq); \& my @headers = grep { $selector\->($_) } @paragraphs; \& \& # just check a paragraph right now: \& \& if ( s_command(\*(Aqhead1\*(Aq, $paragraph) ) { ... } .Ve .PP The selectors can be imported individually or as the \f(CW\*(C`\-all\*(C'\fR group, and can be renamed with Sub::Exporter features. (Selectors cannot \fIyet\fR be curried by Sub::Exporter.) .SS "s_blank" .IX Subsection "s_blank" .Vb 1 \& my $callback = s_blank; \& \& if( s_blank($para) ) { ... } .Ve .PP \&\f(CW\*(C`s_blank\*(C'\fR tests whether a paragraph is a Generic::Blank element. .SS "s_flat" .IX Subsection "s_flat" .Vb 1 \& my $callback = s_flat; \& \& if( s_flat($para) ) { ... } .Ve .PP \&\f(CW\*(C`s_flat\*(C'\fR tests whether a paragraph does Pod::Elemental::Flat \*(-- in other words, is content-only. .SS "s_node" .IX Subsection "s_node" .Vb 1 \& my $callback = s_node; \& \& if( s_node($para) ) { ... } .Ve .PP \&\f(CW\*(C`s_node\*(C'\fR tests whether a paragraph does Pod::Elemental::Node \*(-- in other words, whether it may have children. .SS "s_command" .IX Subsection "s_command" .Vb 3 \& my $callback = s_command; \& my $callback = s_command( $command_name); \& my $callback = s_command(\e@command_names); \& \& if( s_command(undef, \e$para) ) { ... } \& \& if( s_command( $command_name, \e$para) ) { ... } \& if( s_command(\e@command_names, \e$para) ) { ... } .Ve .PP \&\f(CW\*(C`s_command\*(C'\fR tests whether a paragraph does Pod::Elemental::Command. If a command name (or a reference to an array of command names) is given, the tested paragraph's command must match one of the given command names. .SH "AUTHOR" .IX Header "AUTHOR" Ricardo \s-1SIGNES\s0 .SH "COPYRIGHT AND LICENSE" .IX Header "COPYRIGHT AND LICENSE" This software is copyright (c) 2020 by Ricardo \s-1SIGNES.\s0 .PP This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.