home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #18 / NN_1992_18.iso / spool / comp / lang / perl / 5333 < prev    next >
Encoding:
Internet Message Format  |  1992-08-15  |  2.7 KB

  1. Path: sparky!uunet!cs.utexas.edu!wupost!usc!news!netlabs!lwall
  2. From: lwall@netlabs.com (Larry Wall)
  3. Newsgroups: comp.lang.perl
  4. Subject: Re: die hook
  5. Message-ID: <1992Aug15.200817.10538@netlabs.com>
  6. Date: 15 Aug 92 20:08:17 GMT
  7. References: <Aug.13.17.56.21.1992.22441@piecomputer.rutgers.edu> <1992Aug14.153525.18568@merlin.dev.cdx.mot.com>
  8. Sender: news@netlabs.com
  9. Organization: NetLabs, Inc.
  10. Lines: 39
  11. Nntp-Posting-Host: scalpel.netlabs.com
  12.  
  13. In article <1992Aug14.153525.18568@merlin.dev.cdx.mot.com> lezz@merlin.dev.cdx.mot.com (Lezz Giles) writes:
  14. : As a side comment, it's interesting that as I get deeper and deeper into
  15. : Perl I find that often the builtin functions don't quite do what I want (e.g.
  16. : exit() doesn't tidy things up the way I want, system() doesn't handle
  17. : signals and stdout/stderr the way I want, etc. etc.), but I also find
  18. : that Perl is so flexible and powerful that I can almost always write
  19. : replacements that will do precisely what I want.  The only exceptions
  20. : that I've found so far, where I've had to drop down to C code programs
  21. : called via system(), are to find out the current action associated with
  22. : a signal (why, in Grod's name, isn't %SIG initialized at the beginning?),
  23. : and to find out full a filesystem is (which is probably pretty OS-dependent).
  24.  
  25. Loading up %SIG takes a significant number of system calls, which is a
  26. lot of unnecessary overhead for the many programs that don't care.  I
  27. suppose I could do it lazily though, and just make it look as though it
  28. were that way from the start.  If you sent me a patch to do it that way,
  29. I'd probably include it.
  30.  
  31. Filesystem crud is very much OS-dependent.  Your best bet is to try to
  32. parse the output of df.  You can almost always depend on finding a %
  33. character on the percentage-full field, but the real trick is to find
  34. out which filesystem it applies to.  Unfortunately, many versions of
  35. df don't work on any arbitrary file, you have to point them explicitly
  36. at the mount point.  This is silly, since every inode knows the device
  37. it's in.
  38.  
  39. The other silly thing is that df is one of those programs (along with
  40. ps and ESPECIALLY nm) whose output format is CONTINUALLY being screwed
  41. around with because CERTAIN so-called developers think that these
  42. programs' output is to be read only by humans.  Would somebody PLEASE
  43. give these danglesockets a CLUE about how Unix works?  Excuse me, how
  44. Unix OUGHT to work...
  45.  
  46. [Whew.  That feels much better.  But go look at Configure someday, and
  47. count how many ways there are to extract the names of functions from a
  48. library.  Be sure to count the variants that are handled by tricky
  49. little regular expressions and optional switches.  You should get
  50. an answer somewhere between 15 and 30.  I think I'm starting to feel
  51. worse again...]
  52.  
  53. Larry
  54.