about summary refs log tree commit diff
path: root/Completion/User/_perl_basepods
blob: 7f257aed3fa6f170fb3993be654dc1377977c7e6 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#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
      _perl_basepods=( ${podpath}/*.pod(:r:t) )
    fi
  fi
fi

local expl

_wanted pods expl 'Perl base pods' &&
    compadd "$expl[@]" - $_perl_basepods