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

PATCH: cleaner _perl_config_vars()



Index: Completion/Unix/Command/_perl
===================================================================
RCS file: /cvsroot/zsh/zsh/Completion/Unix/Command/_perl,v
retrieving revision 1.1
diff -u -r1.1 _perl
--- Completion/Unix/Command/_perl	2001/04/02 11:59:57	1.1
+++ Completion/Unix/Command/_perl	2001/05/29 14:32:08
@@ -46,10 +46,7 @@
 
 _perl_config_vars () {
   if (( ! $+_perl_config_vars )); then
-    # perl | perl ... nasty, but is there another way?
-    _perl_config_vars=( $(perl -V |
-			    perl -ne 'push @m, (/(\w+)(?==)/g);' \
-			         -e  'END {print join "\n", @m}' ) )
+    _perl_config_vars=( $(perl -MConfig -e 'print join("\n", keys %Config);') )
   fi
 
   local add_colon='-P:'

--From Matt Zimmerman--

/usr/share/zsh/4.0.1-pre-5/functions/Completion/Unix/_perl reads:

_perl_config_vars () {
  if (( ! $+_perl_config_vars )); then
    # perl | perl ... nasty, but is there another way?
    _perl_config_vars=( $(perl -V |
                            perl -ne 'push @m, (/(\w+)(?==)/g);' \
                                 -e  'END {print join "\n", @m}' ) )
  fi

Yes, there is another way:

perl -MConfig -e 'print join("\n", keys %Config);'

is faster, finds more variables, and doesn't misinterpret variable names
('-Darchlib=blah' is seen as a variable named 'Darchlib' by the current code).



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