home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #19 / NN_1992_19.iso / spool / comp / unix / shell / 3605 < prev    next >
Encoding:
Text File  |  1992-08-25  |  4.9 KB  |  109 lines

  1. Newsgroups: comp.unix.shell
  2. Path: sparky!uunet!uunet.ca!canrem!telly!robohack!ve3ied!bduncan
  3. From: bduncan@ve3ied.UUCP (Bill Duncan)
  4. Subject: Re: Octal chmod status
  5. Organization: TFMCS
  6. Date: Tue, 25 Aug 1992 04:25:22 GMT
  7. Message-ID: <1992Aug25.042522.3198@ve3ied.UUCP>
  8. References: <1992Aug18.181609.8988@news.eng.convex.com> <Bt7t36.1w3@mudos.ann-arbor.mi.us> <1992Aug19.130558.8488@news.eng.convex.com>
  9. Lines: 98
  10.  
  11. In article <1992Aug19.130558.8488@news.eng.convex.com> tchrist@convex.COM (Tom Christiansen) writes:
  12. >From the keyboard of mju@mudos.ann-arbor.mi.us (Marc Unangst):
  13. >:In article <1992Aug18.181609.8988@news.eng.convex.com> tchrist@convex.COM (Tom Christiansen) writes:
  14. >:>You might, and people might even use it if they want to lug
  15. >:>another huge a.out and overly large and misplaceable foo.c 
  16. >:>around with them wherever they go.  I'd just use this:
  17. >:>
  18. >:>    perl -e 'printf("%04o\n", (stat($ARGV[0]))[2] & 07777)'
  19. >:
  20. >:Hmm.  Huge a.out, huh?  Overly large foo.c, huh?  Hmm.
  21. >:
  22. >:mju@mudos:~$ ls -l getperms getperms.c
  23. >:-rwxr-xr-x   1 mju      group       4780 Aug 19 01:06 getperms
  24. >:-rw-r--r--   1 mju      group        445 Aug 15 01:08 getperms.c
  25. >:mju@mudos:~$ cd /usr/local/bin
  26. >:mju@mudos:/usr/local/bin$ ls -l perl*
  27. >:lrwxrwxrwx   1 root     other          9 Aug 19 01:07 perl -> perl4.019
  28. >:-rwxr-xr-x   1 bin      bin       283992 Aug 19 01:06 perl4.019
  29. >:mju@mudos:/usr/local/bin$ cd ../src
  30. >:mju@mudos:/usr/local/src$ ls -l perl-4.019.tar.Z
  31. >:-rw-r--r--   1 mju      mju       801616 Aug 10 13:04 perl-4.019.tar.Z
  32. >:mju@mudos:/usr/local/src$ exit
  33. >:
  34. >:Sure looks like my program is smaller.  Could just be an optical
  35. >:illusion, though...
  36. >
  37. >It is.  You're confused.
  38. >
  39. >    % ls -l getperms*
  40. >      60 -rwxr-xr-x  1 tchrist     60785 Aug 19 07:48 getperms
  41. >       2 -rw-r--r--  1 tchrist       452 Aug 19 07:48 getperms.c
  42. >       2 -rw-r--r--  1 tchrist        42 Aug 19 07:49 getperms.pl
  43. >
  44. >You may only include the size of the perl compiler if you 
  45. >include the size of the C compiler.  You may only include
  46. >the size of the perl libraries if you include the size of
  47. >the perl libraries.
  48. >
  49. > etc...
  50.  
  51. As long as you're making up the rules like this, then multiply it out
  52. by the number of times each part will be used.  The C compiler etc. get
  53. used once to produce the binary, and I agree that if you write throwaway
  54. code, the perl one-liner might come out ahead.
  55.  
  56. If it's something that will be used over and over however, be nice to your
  57. neighbors (if it's multi-user), and use the resources appropriately.  No need
  58. to suck perl in every time you need permissions of a file, or to center a line
  59. of text, unless you only need it once of course.
  60.  
  61. As I said in an earlier discussion involving centering a line of text, this
  62. is "deja vu".  It sounds alot like the APL zealots who though everything
  63. should be done in their pet language, instead of stepping back and looking
  64. at things a bit more objectively.  In fact I'm sure alot of these types
  65. of jobs, an old APL hack might do in a "fractional line of code"!  Would
  66. you switch to APL on that basis?
  67.  
  68. I will use awk, sed, sh, m4, C, and whatever other tools are available to
  69. get a job done as expiditiosly as possible, while leaving a client with
  70. something that can be maintained.
  71.  
  72. My problem with perl stems from 2 things.
  73.     a) Philosophically, it's ugly.  It tries to do too many things in one
  74.        place.  Thus, it's borrowed from many of the simpler unix tools,
  75.        but tried to stuff it all in one with an inconsistent language.
  76.        (It's sorta like sed, but not.  It's sorta like awk, but not. etc.)
  77.        And it goes against the grain of building small tools.
  78.  
  79.     b) On a more practical front, I don't like to carry all the perl
  80.        sources to every new client before I can become "productive" in
  81.        their environment.
  82.  
  83. I've seen you mention other scripting languages Tom, but I've only seen
  84. any of your perls...  I agree that not everything should be done in "C".
  85. You also need to weigh how often it will be used, and how fast is "fast
  86. enough".
  87.  
  88. But how about something a little smaller, more appropriate for the task,
  89. and more "universal".  I don't know what you're running on, but it would
  90. take alot longer than those times to suck in half a meg on my machine,
  91. just to get perms on a file!
  92.  
  93. It seems to me, that we may be talking different problem sets too.  You
  94. Tom, may need to support a dozen different architectures on a network.
  95. And each client may only have one user, so the performance issue wouldn't
  96. apply.  In that case, your time is more valuable, and the one-liner is
  97. more justifiable.
  98.  
  99. Many other people (myself included), work with single architecture machines
  100. where there may be many users.  So your argument about "all the binaries..."
  101. doesn't apply, but performance issues do.
  102.  
  103. You can't look at problems in isolation without further context before
  104. deciding what is or is not appropriate.  Unfortunatly, far too many
  105. programmers do.
  106.  
  107. Bill Duncan (bduncan@ve3ied.UUCP -or- ...robohack!ve3ied!bduncan)
  108.  
  109.