[RFC PATCH] nmbug help w/o perldoc

Subject: [RFC PATCH] nmbug help w/o perldoc

Date: Tue, 15 Nov 2011 18:11:16 +0200

To: notmuch@notmuchmail.org

Cc:

From: Tomi Ollila


---

notmuch help runs pod2usage with -verbose => 2, which by default
tries to run perldoc. Adding -noperldoc => 1 disables this use
but there is no pre-verifying interface (or so) available.

In one of my systems there was no 'perldoc' script, which basically
contains:

use Pod::PerlDoc;
exit( Pod::Perldoc->run() );

However, the system has Pod/Perldoc.pm installed. 

This patch demonstraces how Perldoc.pm can be used directly from perl
program. This is probably not the best way, but 'man Perldoc' does not
mention any other way to use the module.

If you have problems running 'notmuch help' (it prints contents of the
command instead of help) and/or are otherwise interested the problem
look this patch and if you have ideas/knowledge how to improve it please
reply to this e-mail.

 contrib/nmbug |    9 +++++----
 1 files changed, 5 insertions(+), 4 deletions(-)

diff --git a/contrib/nmbug b/contrib/nmbug
index bb0739f..343fe10 100755
--- a/contrib/nmbug
+++ b/contrib/nmbug
@@ -5,7 +5,6 @@
 use strict;
 use warnings;
 use File::Temp qw(tempdir);
-use Pod::Usage;
 
 no encoding;
 
@@ -467,14 +466,16 @@ sub decode_from_fs {
 
 
 sub usage {
-  pod2usage ();
+  require Pod::Usage;
+  Pod::Usage::pod2usage ();
   exit (1);
 }
 
 
 sub do_help {
-  pod2usage ( -verbose => 2 );
-  exit (0);
+  require Pod::Perldoc;
+  @ARGV = ( $0 );
+  exit ( Pod::Perldoc->run() );
 }
 
 __END__
--
1.7.7.3


Thread: