#!/usr/bin/perl use strict; use warnings; use File::Basename 'fileparse'; use Pod::Perldoc; my $show_faqnums = (shift||0) eq '-n' ? 1 : 0; @ARGV = qw(-oText -q.); no warnings 'redefine'; sub Pod::Perldoc::search_perlfaqs { my ($self, $found_things, $pod) = @_; local $_; for my $file (@$found_things) { my $perlfaq = fileparse($file, qr/\.pod/); open(INFAQ, '<', $file) or die "$file: $!\n"; my $faqnum = sprintf '%02d', 1; while () { if (/^=head2\s/) { $show_faqnums and substr($_, 7, 0, "[$perlfaq - $faqnum] "); push @$pod, "$_\n"; $faqnum++; } } close(INFAQ); } return; } sub Pod::Perldoc::page { my ($self, $output) = @_; open(TMP, '<', $output) or die "$output: $!\n"; local $_; while () { s/^\s+//; print or die "$!\n"; } close TMP or die "$output: $!\n"; $self->unlink_if_temp_file($output); return; } Pod::Perldoc->run();