Pod::I...Search(3pm)

πŸ’– Pod::Index::Search β€” bestie's guide to hunting keywords in an indexed pod πŸ’–

User Contributed Perl Documentation ✨ (Pod::I...Search(3pm), the manual name, if you were wondering β€” the header truncates it but that's the whole vibe)


🌸 NAME 🌸

Pod::Index::Search β€” literally searching for keywords in an indexed pod, no cap πŸ”


✨ SYNOPSIS ✨

okay so here's the whole serve, copy-paste ready:

use Pod::Index::Search;

my $q = Pod::Index::Search->new;

my @results = $q->search('getprotobyname');

for my $r (@results) {
    printf "%s\t%s\n", $r->podname, $r->line;
    print $r->pod;
}

my @subtopics = $q->subtopics('operator');

that's it. that's the whole main character moment πŸ’…


πŸ¦‹ DESCRIPTION πŸ¦‹

This module searches an index that was created by Pod::Index::Builder. Every search result you get back is a Pod::Index::Entry object. cute, right? πŸŽ€

You can also search for subtopics of a keyword. like, if you search for operator you might get back stuff like:

operator, conditional
operator, filetest
operator, logical
operator, precedence
operator, relational

and the subtopics you get back? just simple strings. no fancy objects, just strings. humble of them honestly 🫢


πŸ‘‘ METHODS πŸ‘‘

πŸ’œ new

my $q = Pod::Index::Search->new(%args);

Creates a shiny new search object. The args you can hand it are:

  • fh β€” the filehandle of the index you wanna use. If you don't pass one, perlindex::DATA gets used instead. it's giving "default bestie" 😌
  • filename β€” the filename of the index you wanna use. and listen: you can pass either fh or filename, but not both. pick a lane babe, it's giving monogamy πŸ’€
  • filemap β€” a subroutine reference that takes a podname and hands you back a filename. a simple lil example could be:
sub {
    my $podname = shift;
    return "/usr/lib/perl5/5.8.7/pod/$podname.pod";
}

just so you know, the podname comes in colon-delimited Perl package syntax 🧚

The default filemap returns the first file in @INC that seems to have the proper documentation β€” that's either a .pod or a .pm file. it goes hunting for you, iconic behavior ⭐

  • nocase β€” if this is true, your search becomes case-insensitive. lowercase, uppercase, doesn't matter, she's not judging πŸ”₯

🌈 search($keyword)

Does the actual search in the index. Returns a list of search results, as Pod::Index::Entry objects. the moment of truth, bestie ✨

🌟 subtopics($keyword, %options)

my @topics = $q->subtopics('operator');
my @topics = $q->subtopics('operator', deep => 1);

Lists the subtopics for a given keyword. If deep is given, it includes all the subtopics; otherwise, only the first level of subtopics gets included. surface level vs. going feral, your choice 😭


πŸ“ VERSION πŸ“

0.14 β€” she's been around a minute and she's still slaying πŸ’–


πŸŽ€ SEE ALSO πŸŽ€

Pod::Index::Entry, Pod::Index::Builder β€” go say hi to the family, iykyk πŸ¦‹


🌸 AUTHOR 🌸

Ivan Tubert-Brohman <itub@cpan.org> πŸ‘‘


Copyright (c) 2005 Ivan Tubert-Brohman. All rights reserved. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.

fr fr, same terms as Perl itself. respect the license bestie πŸ™ˆ

and that's the whole page!! πŸ’–βœ¨ this one's from perl v5.30.0, dated 2020-05-17 β€” so yeah, vintage but still eating πŸŽ€ mwah, go search something iconic πŸŒˆπŸ‘‘

πŸ“¦ where this page comes from