home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #31 / NN_1992_31.iso / spool / comp / lang / perl / 7565 next >
Encoding:
Text File  |  1992-12-21  |  2.1 KB  |  50 lines

  1. Newsgroups: comp.lang.perl
  2. Path: sparky!uunet!zaphod.mps.ohio-state.edu!saimiri.primate.wisc.edu!usenet.coe.montana.edu!news.u.washington.edu!milton!wiml
  3. From: wiml@milton.u.washington.edu (William Lewis)
  4. Subject: Re: Error detection/reporting
  5. Message-ID: <wiml.724923351@milton>
  6. Sender: news@u.washington.edu (USENET News System)
  7. Organization: University of Washington
  8. References: <mcook.724909509@fendahl.dev.cdx.mot.com>
  9. Date: Mon, 21 Dec 1992 07:35:51 GMT
  10. Lines: 38
  11.  
  12. mcook@fendahl.dev.cdx.mot.com (Michael Cook) writes:
  13. >Yes, me too.  It would seem natural that operations like open() and print()
  14. >should produce fatal errors if they couldn't do what you asked.  How often do
  15. >you want to do anything other than die when open() fails?  How often do you
  16. >want to ignore an I/O error?  Hm...
  17.  
  18. Well, I not too infrequently want to be able to handle errors on open(),
  19. but it's not often that I want to try to recover (or even have an idea
  20. how I SHOUDL recover) from an error in "print". Maybe there should be an
  21. option that could be set to make all errors in print automatically fatal.
  22. Better yet, a magic associative array, vaguely like the %SIG array:
  23.  
  24.    %ERR{'print'} = die;
  25.    %ERR{'close'} = warn;
  26.    %ERR{'getpid'} = mysub;
  27.  
  28. sub mysub
  29. {
  30.    die "No parent process? What am I, the kernel?\n";
  31. }
  32.  
  33.    perhaps some arguments could be passed to the error handler ... the
  34. return value from the handler (if it returns) could be used as the return
  35. value from the print/close/getpid call or maybe there should be a way to 
  36. indicate that the call should be tried again ... also, if the error
  37. handling subroutine called because of a 'vec' returns the value -41,
  38. then perl shuld jump to a special routine which will calculate pi
  39. and print the results, in base 11, to file descriptor 8.  :-)
  40.  
  41.    okay, so maybe I got carried away there ...
  42.  
  43.  
  44. (print "Just another perl hacker,\n") || warn "Couldn't JAPH";
  45. -- 
  46. email: wiml@u.washington.edu             |  Home:  Seattle, Washington   |
  47.      (William Lewis)                     |  47 41' 15" N   122 42' 58" W | 
  48. NeXTmail: wiml@ingalls.cs.washington.edu `-------------------------------'
  49.         --*-- Member, Coalition to Preserve Semantic Vacuity --*--
  50.