home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #26 / NN_1992_26.iso / spool / comp / lang / perl / 6977 < prev    next >
Encoding:
Text File  |  1992-11-14  |  2.0 KB  |  49 lines

  1. Newsgroups: comp.lang.perl
  2. Path: sparky!uunet!convex!darwin.sura.net!uvaarpa!caen!hellgate.utah.edu!lanl!newshost.lanl.gov!jgd
  3. From: jgd@acl.lanl.gov (Jerry G. DeLapp)
  4. Subject: Re: Executing required files
  5. In-Reply-To: Tom Christiansen's message of Wed, 11 Nov 1992 14:59:49 GMT
  6. Message-ID: <JGD.92Nov13130042@kodiak.acl.lanl.gov>
  7. Sender: news@newshost.lanl.gov
  8. Reply-To: Jerry G. DeLapp <jgd@acl.lanl.gov>
  9. Organization: Advanced Computing Lab, LANL, NM
  10. References: <1992Nov5.062131.17033@reed.edu>> <JGD.92Nov10153029@kodiak.acl.lanl.gov>
  11.     <mcook.721447621@fendahl.dev.cdx.mot.com>
  12.     <1992Nov11.145949.6745@news.eng.convex.com>
  13. Distribution: comp.lang.perl
  14. Date: Fri, 13 Nov 1992 20:00:42 GMT
  15. Lines: 32
  16.  
  17.  
  18. > From the keyboard of mcook@fendahl.dev.cdx.mot.com (Michael Cook):
  19. > :jgd@acl.lanl.gov (Jerry G. DeLapp) writes:
  20. > :
  21. > :>I still like the idea of __REQUIRED__ to armor plate me from idiots setting $0
  22. > :>though. Any chance of this appearing in 5.0?
  23. > :
  24. > :What's wrong with setting $0?  At the risk of declaring myself an idiot, I do
  25. > :this pretty-much as a matter of course: $0 =~ s%^.*/%%;
  26.  
  27. Regarding Re: Executing required files; Tom Christiansen <tchrist@convex.COM>
  28. adds:
  29.  
  30. Tom> You lose your visible arguments to ps.  Better this way:
  31.  
  32. Tom>     $0 =~ s%^.*/%%;  # clobbered visible @ARGV
  33. Tom>     $0 .= " @ARGV";  # restore
  34.  
  35. Re "idiot..." I was just echoing what I thought was an amusing comment from
  36. the proposed code to solve the problem. I screw around with $0 at times too.
  37. (Yeah, I AM an idiot... paranoid too! ;-).
  38.  
  39. The point is, that if someone alters $0 ahead of the point where you compare
  40. it with __FILE__ you lose the validity of "if ($0 eq __FILE_)" as a test of
  41. whether or not you are in a require. The code will ALWAYS think it's being
  42. required. That's why I'd like to see __REQUIRED__ as a reliable piece of
  43. information.
  44.  
  45. --
  46.  
  47. Jerry G. DeLapp -- ACL System Scientist -- (505) 665-4531 <jgd@lanl.gov>
  48. Computing beyond the Bleeding Edge -- The Advanced Computing Laboratory
  49.