about summary refs log tree commit diff
path: root/Completion/User/_perl_basepods
diff options
context:
space:
mode:
authorTanaka Akira <akr@users.sourceforge.net>1999-09-05 22:04:03 +0000
committerTanaka Akira <akr@users.sourceforge.net>1999-09-05 22:04:03 +0000
commit4a34edc4855ef9d6a74c4658a2ed4f0f8bc1f130 (patch)
tree7fc49640b47e2caecb10c4a8d3867d5df51362be /Completion/User/_perl_basepods
parent63680c108bd05f3cb9401a7fcf547b53381d2c17 (diff)
downloadzsh-4a34edc4855ef9d6a74c4658a2ed4f0f8bc1f130.tar.gz
zsh-4a34edc4855ef9d6a74c4658a2ed4f0f8bc1f130.tar.xz
zsh-4a34edc4855ef9d6a74c4658a2ed4f0f8bc1f130.zip
Initial revision
Diffstat (limited to 'Completion/User/_perl_basepods')
-rw-r--r--Completion/User/_perl_basepods30
1 files changed, 30 insertions, 0 deletions
diff --git a/Completion/User/_perl_basepods b/Completion/User/_perl_basepods
new file mode 100644
index 000000000..f4e70382b
--- /dev/null
+++ b/Completion/User/_perl_basepods
@@ -0,0 +1,30 @@
+#autoload
+#
+# _perl_basepods - zsh completion function
+#
+# Adam Spiers <adam@spiers.net>
+#
+# Calculate all installed Perl base pods (perlfunc, perlfaq etc.).
+# The result is cached for future use.
+#
+
+if [[ ${+_perl_basepods} -eq 0 ]]; then
+  typeset -agU _perl_basepods
+
+  if which basdepods >/dev/null; then
+    _perl_basepods=( ${$(basepods):t:r} )
+  else
+    local podpath
+    podpath=$(perl -MConfig -e 'print "$Config{installprivlib}/pod"')
+    if [[ ! -e $podpath/perl.pod ]]; then
+      echo "Couldn't find perl.pod from Config.pm; giving up."
+      return 1
+    else
+      cd $podpath
+      _perl_basepods=( *.pod(:r:t) )
+      cd $OLDPWD
+    fi
+  fi
+fi
+
+compadd - $_perl_basepods