Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:

The title of this node is the description of Pod::Select. It does exactly what is needed but the POD warns, "NOTE: This module is considered legacy; modern Perl releases (5.18 and higher) are going to remove Pod-Parser from core and use Pod-Simple for all things POD." I'm familiar with Pod::Simple but don't see how to use it to replace Pod::Select. The docs mention subclassing but I don't want to roll my own anything to parse pod. I could do that manually with no modules in 2 seconds flat. Does anyone know how to "Extract selected sections of POD" with Pod::Simple or other core modules? Thank you.

Replies are listed 'Best First'.
Re: Extract selected sections of POD
by choroba (Cardinal) on Jul 13, 2018 at 22:06 UTC
    The second hit in the second link shows Pod::Simple::Select. Is that what you need?

    ($q=q:Sq=~/;[c](.)(.)/;chr(-||-|5+lengthSq)`"S|oS2"`map{chr |+ord }map{substrSq`S_+|`|}3E|-|`7**2-3:)=~y+S|`+$1,++print+eval$q,q,a,

        Pod::Simple::Select looks perfect, but it's not a core module.

        But you can still read the source code

Re: Extract selected sections of POD
by haukex (Archbishop) on Jul 14, 2018 at 09:12 UTC

    You might want to take a look at how Pod::Usage does it. The following is a bit of a hack in that it doesn't use the module for its real purpose, but perhaps it's close to what you're looking for?

    use warnings; use strict; use Pod::Usage; =head1 SYNOPSIS Synopsis =head1 FOO Foo! =head1 BAR Bar! =head1 QUZ Quz! =cut open my $fh, '>', \my $str or die $!; pod2usage(-exitval=>'NOEXIT',-verbose=>99,-output=>$fh, -sections=>['FOO','QUZ']); close $fh; print "<<$str>>\n"; __END__ <<foo: Foo! quz: Quz! >>
Re: Extract selected sections of POD
by VinsWorldcom (Prior) on Jul 14, 2018 at 00:37 UTC
Re: Extract selected sections of POD
by pryrt (Abbot) on Jul 16, 2018 at 14:08 UTC

    I've been doing some simple research on this, since I use podselect (part of the Pod-Parser distibution) in my Makefile.PL for creating the README, and I wondered whether my build environment would suddenly break. (fortunately, the README generation is only important for building the dist, and shouldn't break tests or installs).

    I found that while Pod::Parser's documentation does say that "modern Perl releases (5.18 and higher) are going to remove Pod-Parser from core", as of 5.26.1, Pod::Parser is still listed in core (the most recent list on perldoc.perl.org). Running corelist Pod::PodParser still implies it's in core (I compared to the phrasing for corelist CGI, which explicitly says it's removed from core; Pod::Parser doesn't mention that, so that tells me corelist still thinks it's core). And corelist -a Pod::Parser shows that Pod::Parser itself has been updated since 5.18 was released:

    v5.18.0 1.60 ... v5.19.1 1.61 ... v5.19.9 1.62 ... v5.21.9 1.63 ... ... v5.27.10 1.63
    ... so it's not like they didn't know it hadn't been removed from core as of 5.18. I would consider that a bug in the documentation -- since it says "are going to remove", but it's in the past, and hasn't happened yet.

    Do others agree, or does my use of the word "core" (and my research results) not reflect the state of truly "core" by some technical definition?

      The bug was reported.

      ($q=q:Sq=~/;[c](.)(.)/;chr(-||-|5+lengthSq)`"S|oS2"`map{chr |+ord }map{substrSq`S_+|`|}3E|-|`7**2-3:)=~y+S|`+$1,++print+eval$q,q,a,

        Thanks. I was going to do the bug report, but I wanted confirmation before filing. If that confirmation came in the form of the bug being reported, that works, too. :-)