Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

PATCH: improved _perl_modules



If Perl isn't found by the `which' below, it might be nice to warn the
user, but I don't know how to do that.  I thought of _message but the
list of completions gets in the way ...  Maybe it's not worth the
effort.

I haven't committed this to CVS yet, because I lost track of what was
decided about references to sequence numbers and ChangeLogs etc.  Can
some kind soul please summarise the procedure? (and confirm that I'm
trusted enough to make small changes like this without cocking up
badly ;-)  Thanks.


Index: Completion/User/_perl_modules
===================================================================
RCS file: /cvsroot/zsh/zsh/Completion/User/_perl_modules,v
retrieving revision 1.1.1.6
diff -u -r1.1.1.6 _perl_modules
--- Completion/User/_perl_modules	2000/03/23 04:19:30	1.1.1.6
+++ Completion/User/_perl_modules	2000/04/22 16:05:40
@@ -26,7 +26,17 @@
     _perl_modules=( $(pminst) )
   else
     local inc libdir new_pms
-    inc=( $( perl -e 'print "@INC"' ) )
+    if which perl >/dev/null; then
+      inc=( $( perl -e 'print "@INC"' ) )
+    else
+      # If perl isn't there, one wonders why the user's trying to
+      # complete Perl modules.  Maybe her $path is wrong?
+
+      setopt localoptions extendedglob
+      inc=( /usr/lib/perl5{,/{site_perl/,}<5->.([0-9]##)}(N) 
+            ${(s.:.)PERL5LIB} )
+    fi
+
     typeset -agU _perl_modules  # _perl_modules is global, no duplicates
     _perl_modules=( )
 
@@ -36,7 +46,7 @@
 
       # Find all modules
       cd $libdir
-      new_pms=( {[A-Z]*/**/,}*.pm(N) )
+      new_pms=( {[A-Z]*/***/,}*.pm~*blib*(N) )
       cd $OLDPWD
 
       # Convert to Perl nomenclature



Messages sorted by: Reverse Date, Date, Thread, Author