| App-perlzonji documentation | Contained in the App-perlzonji distribution. |
App::perlzonji - A more knowledgeable perldoc
version 1.111500
# perlzonji UNIVERSAL::isa
# (runs `perldoc perlobj`)
perlzonji is like perldoc except it knows about more things. Try these:
perlzonji xor
perlzonji foreach
perlzonji isa
perlzonji AUTOLOAD
perlzonji TIEARRAY
perlzonji INPUT_RECORD_SEPARATOR
perlzonji '$^F'
perlzonji PERL5OPT
perlzonji :mmap
perlzonji __WARN__
perlzonji __PACKAGE__
perlzonji head4
For efficiency, alias pod=perlzonji.
The word zonji means "knowledge of" in Japanese. Another example
is the question "gozonji desu ka", meaning "Do you know?" - "go" is a
prefix added for politeness.
The main function, which is called by the perlzonji program.
Takes as argument the name of a module, tries to load that module and executes the formatter, giving that module as an argument. If loading the module fails, this subroutine does nothing.
Executes the given command using exec(). In debug mode, it also
prints the command before executing it.
Takes a word and returns the matches for that word. It's in a separate function to separate logic from presentation so other programs can use this module as well.
Options can be shortened according to "Case and abbreviations" in Getopt::Long.
--perldoc-command, -cSpecifies the POD formatter/pager to delegate to. Default is .
perldoc annopod from AnnoCPAN::Perldoc is a better .
alternative .
--debugPrints the whole command before executing it.
--dry-run, -nJust print the command that would be executed; don't actually execute it.
--help, -h, -?Prints a brief help message and exits.
--man, -mPrints the manual page and exits.
See perlmodinstall for information and options on installing Perl modules.
No bugs have been reported.
Please report any bugs or feature requests through the web interface at http://rt.cpan.org/Public/Dist/Display.html?Name=App-perlzonji.
The latest version of this module is available from the Comprehensive Perl Archive Network (CPAN). Visit http://www.perl.com/CPAN/ to find a CPAN site near you, or see http://search.cpan.org/dist/App-perlzonji/.
The development version lives at http://github.com/hanekomu/App-perlzonji and may be cloned from git://github.com/hanekomu/App-perlzonji.git. Instead of sending patches, please fork this project using the standard git and github infrastructure.
This software is copyright (c) 2010 by Marcel Gruenauer.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.
| App-perlzonji documentation | Contained in the App-perlzonji distribution. |
use 5.008; use strict; use warnings; package App::perlzonji; BEGIN { $App::perlzonji::VERSION = '1.111500'; } # ABSTRACT: A more knowledgeable perldoc use Getopt::Long; use Pod::Usage; use Class::Trigger; use Module::Pluggable require => 1; __PACKAGE__->plugins; # 'require' them sub run { our %opt = ('perldoc-command' => 'perldoc'); GetOptions(\%opt, qw(help|h|? man|m perldoc-command|c:s debug dry-run|n)) or pod2usage(2); if ($opt{help}) { pod2usage( -exitstatus => 0, -input => __FILE__, ); } if ($opt{man}) { pod2usage( -exitstatus => 0, -input => __FILE__, -verbose => 2 ); } my $word = shift @ARGV; my $matches = find_matches($word); if (@$matches) { if (@$matches > 1) { warn sprintf "%s matches for [%s], using first (%s):\n", scalar(@$matches), $word, $matches->[0]; warn " $_\n" for @$matches; } execute($opt{'perldoc-command'}, $matches->[0]); } # fallback warn "assuming that [$word] is a built-in function\n" if $opt{debug}; execute($opt{'perldoc-command'}, qw(-f), $word); } sub find_matches { my $word = shift; my @matches; __PACKAGE__->call_trigger('matches.add', $word, \@matches); return \@matches; } sub execute { our %opt; if ($opt{'dry-run'}) { # under --dry-run, don't pretend to execute more than once our $executed; return if $executed++; warn "@_\n"; } else { warn "@_\n" if $opt{debug}; exec @_; } } 1; __END__