Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris
 
PerlMonks  

List all perldoc FAQs

by Dietz (Curate)
on Sep 18, 2006 at 16:44 UTC ( [id://573577]=CUFP: print w/replies, xml ) Need Help??

This will list all FAQs from perlfaq[1-9] without their answers. Just a modification of subroutines from Pod::Perldoc.

Sample output:

$ perldocfaqs What is Perl? Who supports Perl? Who develops it? Why is it free? ..snip... What machines support perl? Where do I get it? ...snip... How do I fetch/put an FTP file? How can I do RPC in Perl?
Lists all FAQs line by line

$ perldocfaqs -n [perlfaq1 - 01] What is Perl? [perlfaq1 - 02] Who supports Perl? Who develops it? Why is it free? ...snip... [perlfaq2 - 01] What machines support perl? Where do I get it? ...snip... [perlfaq9 - 25] How do I fetch/put an FTP file? [perlfaq9 - 26] How can I do RPC in Perl?
Called with '-n' lists all FAQs with leading file info and faq number
#!/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 (<INFAQ>) { 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 (<TMP>) { s/^\s+//; print or die "$!\n"; } close TMP or die "$output: $!\n"; $self->unlink_if_temp_file($output); return; } Pod::Perldoc->run();

Replies are listed 'Best First'.
Re: List all perldoc FAQs
by wazoox (Prior) on Sep 18, 2006 at 20:49 UTC
    Now what would be nice : enhance this to build automatically a quiz game :)

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: CUFP [id://573577]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others surveying the Monastery: (3)
As of 2024-04-26 00:03 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found