Index and search local perl documentation
####################################### # Command line utility: ####################################### # This is permanent and needs to be performed only once # (or if new documentation gets installed). $ perldig -u # Then, search: $ perldig log AND apache AND connect 1) CGI/Carp.pm 2) CGI/Prototype.pm 3) DBI/Changes.pm 4) DBI/Changes.pm Enter number of choice: ####################################### # API ####################################### use Perldoc::Search; my $searcher = Perldoc::Search->new(); # This is permanent and needs to be performed only once # (or if new documentation gets installed). $searcher->update(); # Then, search: for my $hit ($searcher->search("log AND apache")) { print $hit->path(), "\n"; }
\*(C`Perldoc::Search\*(C' uses the swish-e engine to index the local Perl documentation. It provides both the command line utility \*(C`perldig\*(C' and an \s-1API\s0 to perform searches on the index. It uses \*(C`SWISH::API::Common\*(C' as the indexing and search engine.
Most likely, you will want the command line utility \*(C`perldig\*(C', please check the documentation that comes with it by calling
perldoc perldig
In case you're interested in the \s-1API\s0, read on.
Instantiates a searcher object. Usually takes no parameters. If you like to modify the searched directories or want to pass different options to \*(C`SWISH::API::Common\*(C', go ahead: use Config;
my $searcher = Perldoc::Search->new( dirs => [$Config{installsitearch}, $Config{installsitelib}, $Config{installarchlib}, $Config{installprivlib}, ], swish_options => { swish_adm_dir => "$ENV{HOME}/.perldig", } ); Update the index. This operation might take a couple of minutes. Perform a search on the index with the given query. Returns a list of result objects. # Search documents containing # both "foo" and "bar" for my $hit ($swish->search("foo AND bar")) { print $hit->path(), "\n"; }
Copyright 2005 by Mike Schilli, all rights reserved. This program is free software, you can redistribute it and/or modify it under the same terms as Perl itself.
2005, Mike Schilli <[email protected]>