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