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