#!/usr/bin/perl use strict; use Pod::Find; use Pod::PlainText; use IO::String; die "Usage $0 \n" unless @ARGV; my $sub = shift @ARGV; my @dirs = @ARGV ? @ARGV : ('.'); print "Searching for $sub in @dirs\n"; my %pods = Pod::Find::pod_find( {-verbose => 0}, @dirs ); for my $file ( keys %pods ) { open my $fh, $file or die "Can't read $file $!\n"; local $/ = "\n="; # split into pod paragraph chunks while (<$fh>) { next unless m/^(\w+).*\b$sub\b/i; chop; s/^(\w+)/=head1/; # kludge to fix parser issue with isolated tokens print "\n-----$file\n"; my $io = IO::String->new($_); Pod::PlainText::pod2text($io); } }