home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #30 / NN_1992_30.iso / spool / comp / lang / perl / 7388 < prev    next >
Encoding:
Text File  |  1992-12-13  |  2.6 KB  |  61 lines

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