perlzonji, a more knowledgeable perldoc

It seems I need to step up my marketing. :) Curtis Poe (Ovid) wrote perlfind — perldoc on steroids. My thought was “This is a really good idea; I should have thought of this! Oh, wait…”

Update: I’ve renamed it to App::perlfind. See this article and the distribution on CPAN.

So, let me advertise App::perlzonji. The somewhat weird name is probably one reason Ovid couldn’t find the module, but it’s a bit late to change the name now, since I know that perlzonji has a few satisfied users already. Anyway, a lesson learned.

perlzonji describes itself as “a more knowledgeable perldoc”. It allows you to search for documentation on things that perldoc doesn’t know about. Some examples:

perlzonji xor
perlzonji foreach
perlzonji isa
perlzonji AUTOLOAD
perlzonji TIEARRAY
perlzonji INPUT_RECORD_SEPARATOR
perlzonji '$^F'
perlzonji '\Q'
perlzonji PERL5OPT
perlzonji :mmap
perlzonji __WARN__
perlzonji __PACKAGE__
perlzonji head4
perlzonji UNITCHECK

And best of all, you can extend perlzonji with plugins. The plugin system is based on Class::Trigger; plugins in the App::perlzonji::Plugin:: namespace are automatically loaded with Module::Pluggable.

For example, perlzonji comes with a plugin App::perlzonji::Plugin::SpecialPackages. It knows, among other things, that the CORE package is described by perlsub, and assumes that if you search for CORE::open, you might be more interested in the documentation for CORE than in that for open().

Here is the essential plugin code:

package App::perlzonji::Plugin::SpecialPackages;
use strict;
use warnings;
use App::perlzonji;
App::perlzonji->add_trigger(
    'matches.add' => sub {
        my ($class, $word, $matches) = @_; 
        $word =~ /^UNIVERSAL::/ && push @$matches, 'perlobj';
        $word =~ /^CORE::/      && push @$matches, 'perlsub';
    }   
);

So, I hope you find perlzonji useful. If you have any suggestions on improving it, let me know. I already have a feature request from Steven Haryanto to make perldoc lib/Some/Module/File.pm work and hope to get around to implementing that next week.

flattr this!

5 thoughts on “perlzonji, a more knowledgeable perldoc

    • Yes; Miyagawa said something similar — just put App::perlzonji in the new dist as well, increase the version, and redirect to the new module, plus deprecation notice. Something like what Plack::Server::CGI looks, I guess.

      Now we just need a new name. :) Maybe Curtis and I can cooperate and call it perlfind, or maybe perlknow, perllook, perlshow or something similar. Any ideas?

      • I like perllook quite well, actually – better than perlfind in fact. The others… not so much. Other options that come to mind are perlwhat (I rather like this after letting it sink in for a moment) or maybe perlhow.

        Ideally, though, wouldn’t it be perldoc -A or some such instead? Is there a reason this can’t or shouldn’t be added to Pod::Perldoc so that all users may profit from it? It may have to leave out a plugging mechanism – otherwise it seems the way to go. (Does that just provide an opportunity though, or do you see it addressing a need, other than maybe perlzonji’s own?)

        • Right; I like that it’s pluggable and that the user doesn’t have to know whether it’s a module, function, keyword or something else.

          It’d be nice to somehow integrate it with perldoc, however, since perldoc has a lot more options.

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>