about summary refs log tree commit diff
diff options
context:
space:
mode:
authorOliver Kiddle <opk@users.sourceforge.net>2003-04-23 10:41:13 +0000
committerOliver Kiddle <opk@users.sourceforge.net>2003-04-23 10:41:13 +0000
commit9e302211abf5c6403b15feb128a822921f13674e (patch)
tree4ad1db70b90c24b54ecb5cc987697149eb4103d0
parent537f405ca1816d7a800026823bfa439886aa85a3 (diff)
downloadzsh-9e302211abf5c6403b15feb128a822921f13674e.tar.gz
zsh-9e302211abf5c6403b15feb128a822921f13674e.tar.xz
zsh-9e302211abf5c6403b15feb128a822921f13674e.zip
18461: handle cases where the perlfunc man page is compressed
-rw-r--r--ChangeLog5
-rw-r--r--Completion/Unix/Type/_perl_builtin_funcs36
2 files changed, 24 insertions, 17 deletions
diff --git a/ChangeLog b/ChangeLog
index 07f93d748..ad25b8b1b 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2003-04-23  Oliver Kiddle  <opk@zsh.org>
+
+	* 18461: Completion/Unix/Type/_perl_builtin_funcs: handle cases
+	where the perlfunc man page is compressed
+
 2003-04-22  Felix Rosencrantz <f_rosencrantz@yahoo.com>
 
 	* 18459: Completion/Unix/Command/_screen: fix up suggestions from
diff --git a/Completion/Unix/Type/_perl_builtin_funcs b/Completion/Unix/Type/_perl_builtin_funcs
index 65eebf9b1..1c01a0dd6 100644
--- a/Completion/Unix/Type/_perl_builtin_funcs
+++ b/Completion/Unix/Type/_perl_builtin_funcs
@@ -1,31 +1,33 @@
 #autoload
 #
-# _perl_builtin_funcs - zsh completion function
-#
-# Adam Spiers <adam@spiers.net>
-#
-# Calculate all built-in Perl functions.  The result is cached
+# Parses perlfunc(1) to get a list of perl functions. The result is cached
 # for future use.
-#
 
-if [[ ${+_perl_builtin_funcs} -eq 0 ]]; then
+if (( ! $+_perl_builtin_funcs )); then
   typeset -agU _perl_builtin_funcs
   local perlfunc
 
-  if [[ -n "${perlfunc:=$(man -w perlfunc 2>/dev/null; print -l ${^manpath}/man1/perlfunc.1(N) {/usr/man,/usr/share/man,/usr/local/man}/man1/perlfunc.1(N))}" ]]; then
-    _perl_builtin_funcs=( `perl -lne '
-                             $in_funcs++, next if /Alphabetical/;     \
-                             next unless $in_funcs;                   \
-                             if (/^\.Ip "(\w+)/) {                    \
-                               print $1 unless $func{$1}; $func{$1}++ \
-                             }' $=perlfunc`
-               )
+  if [[ -n "${perlfunc:=$(man -w perlfunc 2>/dev/null; print -l ${^manpath:-${(s.:.)$(manpath)}}/man1/perlfunc.1(|[zZ]|gz|bz2)(N) {/usr/man,/usr/share/man,/usr/local/man}/man1/perlfunc.1(|[zZ]|gz|bz2)(N))}" ]]; then
+    case $perlfunc in
+      *.bz2) perlfunc="bzip2 -cd $perlfunc" ;;
+      *[zZ]) perlfunc="gzip -cd $perlfunc" ;;
+      *) perlfunc="cat $perlfunc" ;;
+    esac
+    _perl_builtin_funcs=(
+      $($=perlfunc | perl -lne '
+      $in_funcs++, next if /Alphabetical/;
+      next unless $in_funcs;
+      if (/^\.I[pP] "(\w+)/) {
+        print $1 unless $func{$1}; $func{$1}++
+      }')
+    )
   else
-    echo "Couldn't find perlfunc man page; giving up."
+    _message "can't find perlfunc man page; giving up"
     return 1
   fi
 fi
 
 local expl
 
-_wanted functions expl 'Perl built-in functions' compadd -a _perl_builtin_funcs
+_wanted functions expl 'perl built-in function' compadd "$@" -a - \
+    _perl_builtin_funcs