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

Re: PATCH: zsh and perl



On Nov 15, 11:56am, Sven Wischnowsky wrote:
}
} I'm sure I'm missing something, but... why not just avoid the cd
} altogether? Something like
} 
}   new_pms=( $libdir/{[a-Z]*/***/,}*.pm~*blib* )
}   new_pms=( "${(@)new_pms#$libdir/}" )

I wondered about that myself.

} probably testing if $libdir is non-empty before that...

We already have reasonably confidence that $libdir is non-empty because it
came either from perl's @INC array or from a previous glob which it's then
iterating over with `for'.  It also tests [[ -d $libdir && -x $libdir ]],
so I can't think of any reason for doing the cd.

(Does this recursive glob with *** potentially have the same automounting
problem that we hacked around in _path_files?)

I used $libdir/## for the pattern removed from each word, just in case
$libdir already had a trailing slash before we added another one.  The
other change is just in case `.' is not the last element of @INC, for
whatever odd reason.  It might make more sense to avoid the recursive
glob for `.', rather than skip it entirely.

Index: Completion/User/_perl_modules
===================================================================
RCS file: /extra/cvsroot/zsh/zsh-3.1/Completion/User/_perl_modules,v
retrieving revision 1.14
diff -u -r1.14 _perl_modules
--- _perl_modules	2000/11/15 15:39:37	1.14
+++ _perl_modules	2000/11/15 15:44:11
@@ -67,13 +67,12 @@
 
       for libdir in $inc; do
         # Ignore cwd - could be too expensive e.g. if we're near /
-        if [[ $libdir == '.' ]]; then break; fi
+        if [[ $libdir == '.' ]]; then continue; fi
 
         # Find all modules
         if [[ -d $libdir && -x $libdir ]]; then
-        builtin cd $libdir
-        new_pms=( {[A-Z]*/***/,}*.pm~*blib* )
-        builtin cd $OLDPWD
+          new_pms=( $libdir/{[A-Z]*/***/,}*.pm~*blib* )
+          new_pms=( "${(@)new_pms#$libdir/##}" )
         fi
 
         # Convert to Perl nomenclature

-- 
Bart Schaefer                                 Brass Lantern Enterprises
http://www.well.com/user/barts              http://www.brasslantern.com

Zsh: http://www.zsh.org | PHPerl Project: http://phperl.sourceforge.net   



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