#!/usr/bin/perl # sburke@cpan.org -- Time-stamp: "2005-08-19 01:40:58 ADT" # # desc{ Grep the Perl standard POD for a given regexp } # Example usage: greppod thingy use strict; my @dirs = grep {; -e $_ and -d _ and -r _} map "$_/pod", @INC; die "What pattern?" unless @ARGV == 1; my $re = $ARGV[0]; die "No pod dirs under any of @INC?" unless @dirs; foreach my $d (@dirs) { opendir(INDIR, $d) || die "Can't opendir $d: $!\n"; my @files = grep { -e $_->[0] and -f _ and -r _ } map { $_ eq '.' ? () : $_ eq '..' ? () : [ "$d/$_", $_ ] } sort readdir(INDIR); close(INDIR); foreach my $f (@files) { open(IN, "<" . $f->[0]) || die "Can't readopen " . $f->[0] . ": $!\n"; while() { print $f->[1], ':', $_ if m/$re/o; } close(IN); } } exit;