zsh-workers
 help / color / mirror / code / Atom feed
* PATCH: cleaner _perl_config_vars()
@ 2001-05-29 14:33 Clint Adams
  0 siblings, 0 replies; only message in thread
From: Clint Adams @ 2001-05-29 14:33 UTC (permalink / raw)
  To: zsh-workers


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).


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2001-05-29 14:33 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-05-29 14:33 PATCH: cleaner _perl_config_vars() Clint Adams

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).