John Kirk on Fri, 14 Apr 2000 20:34:19 -0400 (EDT) |
Hi Hao and all, On Fri, Apr 14, 2000 at 04:17:27PM -0400, Simply Hao wrote: > I'm not sure what you're trying to do. I've elaborated in response to Robert. Does that clarify? > Is it something like this? > caller: > #!/usr/bin/perl -w > system (shift, $0) if @ARGV; > > processor: > #!/usr/bin/perl -w > system ('cat', shift) if @ARGV; > % caller processor (I guess I never noticed that @_, on entry to a program, refers to @ARGV.) Well, the result I need is to have the reference to the processor occur in the caller, rather than in the invocation of the caller. That's easy to fix in your proposal. I suppose, then, that the crux of your suggestion is that I pass the caller's name explicitly as an argument to the processor, rather than attempting to have it implicit in the calling mechanism the OS and perl is (might be) supporting. Since the implicit passing of the script's name, that the shebang mechanism implements, isn't available to a script that's targeting another shebanged script, I have to mention the caller's name explicitly in the caller's code anyway, to use the exec() feature (or, in your suggestion, the system call). Therefore, there's no payoff in trying to avoid passing it explicitly as an argument. Good observation! I was so fixated on the idea of making things implicit, that I missed that point. Now, my tst00 file could look like: #!/usr/bin/perl -w $IFH=shift; print "tst00: processing $IFH\n"; open IFH;while(<IFH>){print;};close IFH; 1; and my tst02 file looks like: #!/usr/bin/perl -w exec 'tst00',$0; __END__ more stuff and even more stuff so that tst02 asks tst00 to look back at itself. My purpose here is to have other stuff in tst02 after the exec line, and to have tst00 do other things to tst02 than just print it. Now, how do I get the effects of the exec line (and the __END__ line) in tst02 up into the line above (the shebang line)? Maybe the shebang line will need to bring in a package that takes care of everything before the rest of tst02 ever gets to perl's compiler. A source filter, or something arcane like that? Thanks, Hao! You've moved me onward and upward into even more trouble. regards, -- John Kirk **Majordomo list services provided by PANIX <URL:http://www.panix.com>** **To Unsubscribe, send "unsubscribe phl" to majordomo@lists.pm.org**
|
|