I'm trying to extract a portion of a Perl POD and nothing else. If I run the following:
use strict;
use warnings;
use Pod::Simple;
use Pod::Text;
=head1 podTest
normal pod
=cut
print "normalPod:\n";
my $writeNormalPod = Pod::Text->new();
$writeNormalPod->parse_from_file(__FILE__);
=pod
all pod
=cut
print "\nallPod:\n";
my $writePod = Pod::Text->new();
$writePod->accept_targets( ('special') );
$writePod->parse_from_file(__FILE__);
=begin special
special pod
=end special
=cut
print "\nspecialPod:\n";
my $writeSpecialPod = Pod::Text->new();
# what to have here?
$writeSpecialPod->parse_from_file(__FILE__);
# in order to print "special pod" and nothing else
Then I get the output:
normalPod:
podTest
normal pod
all pod
allPod:
podTest
normal pod
all pod
special pod
specialPod:
How can I get special pod
and nothing else?
Things I've tried:
- unaccepting codes, directives, and targets
- attaching code (and cut, pod, and whiteline) handlers
- Web searching (at best, this turns up how to use a format name)
Is there an easy way to get only a specific format out of a POD, or should I just parse the file on my own?