home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.lang.perl
- Path: sparky!uunet!spillman!tye
- From: tye@spillman.uucp (E. Tye McQueen)
- Subject: Re: Perl-side globbing (was Re: Perl Shell...)
- Message-ID: <1992Dec13.085331.33023@spillman.uucp>
- Date: Sun, 13 Dec 1992 08:53:31 GMT
- References: <18086@autodesk.COM> <1992Dec10.073900.16503@spillman.uucp> <1992Dec11.212055.21505@news.eng.convex.com>
- Organization: Spillman Data Systems
- Lines: 50
-
- [my simulation of <*>]
-
- Tom Christiansen <tchrist@convex.COM> writes:
- )I've always used this...
- )[Tom's simulation of <*>]
-
- Much simpler, probably faster, gives you the alternative of using
- "regular expression globbing" but doesn't handle \-quoting or /'s
- inside {}. I don't use \-quoting much but I use /'s in {} quite
- often. I don't think these can be changed without radical
- modifications.
-
- Of course, my glob.pl has its own idiosyncracies (for example,
- doesn't handle ' or " quoting and ~{fred,joe}/.pro* works but
- one ksh I tried doesn't handle that). I was hoping with a bit
- of work any meaningful differences between my glob.pl and csh
- globbing could be resolved and Perl could have *safe* globbing
- without any loss of functionality.
-
- glob2re.pl (which I wrote much before glob.pl) handles % for
- "any number of subdirectories" (something I really miss from VMS
- wildcards) but glob2re is "passive" (you have to use something
- like "find" to generate the file names and glob2re tells you
- which ones match). But my glob.pl never would have happened if
- glob2re.pl wasn't lying around.
-
- I included \-quoting for completeness but now that I'm trying
- to reproduce csh-globbing I guess ' and " may need to be
- supported as well.
-
- After posting I realized that I didn't properly note that my
- routines don't do any sorting. I intentionally left it out
- since it is so easy to include it when you want it and impossible
- to remove it when you don't (I just had a problem where I needed
- to find out which directories had subdirectory entries *after*
- the entry for a symbolic link -- "find.pl" was skipping directories
- because our system supports symbolic links but Perl was build on
- a binary-compatible system that doesn't have an lstat call).
-
- I wonder what will happen if I build an lstat-capable Perl and
- run it on a binary-compatible system that doesn't have lstat.
-
- Back to sorting. I think I'll have to rename glob() to rawglob()
- and make glob() just "sort &rawglob()" so most get what they
- expect but you can skip the sorting when you want.
-
- tye@spillman.com Tye McQueen, E.
- ----------------------------------------------------------
- Nothing is obvious unless you are overlooking something.
- ----------------------------------------------------------
-