1#autoload
2#
3# _perl_basepods - zsh completion function
4#
5# Adam Spiers <adam@spiers.net>
6#
7# Calculate all installed Perl base pods (perlfunc, perlfaq etc.).
8# The result is cached for future use.
9#
10
11if (( ! $+_perl_basepods )); then
12  typeset -agU _perl_basepods
13
14  if (( ${+commands[basepods]} )); then
15    _perl_basepods=( ${$(basepods):t:r} )
16  else
17    local podpath
18
19    podpath=$(perl -MConfig -e 'print "$Config{installprivlib}/pod"')
20
21    if [[ ! -e $podpath/perl.pod ]]; then
22      _message "can't find perl.pod from Config.pm; giving up"
23      return 1
24    else
25      _perl_basepods=( ${podpath}/*.pod(:r:t) )
26    fi
27  fi
28fi
29
30local expl
31
32_wanted pods expl 'perl base pod' compadd -a "$@" - _perl_basepods
33