home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!eiffel!eiffel.com
- From: ram@eiffel.com (Raphael Manfredi)
- Newsgroups: comp.lang.perl
- Subject: Re: system() vs exec()
- Message-ID: <162@eiffel.eiffel.com>
- Date: 18 Dec 92 18:02:40 GMT
- References: <2B30B274.616E@tct.com> <mcook.724624157@fendahl.dev.cdx.mot.com> <2B31E577.99FA@tct.com>
- Sender: ram@eiffel.com
- Organization: Interactive Software Engineering, Santa Barbara CA
- Lines: 39
-
- Quoting chip@tct.com (Chip Salzenberg) from comp.lang.perl:
- >According to mcook@fendahl.dev.cdx.mot.com (Michael Cook):
- >>Besides, you've used @_ after you used local(). That's a Perl no-no.
- >
- >Oh?
-
- It's not a Perl no-no, rather a perl 4.0 no-no.
-
- If you declare:
-
- local($pid);
-
- and then use '@_' to refer to the argument list for your routine, then there
- is a possibility, a chance (sic), that somehow your parameter gets clobbered
- by the local declaration.
-
- Example:
-
- sub foo {
- local($pid) = '1';
- print "Argument #1: $_[0]\n";
- }
-
- &foo('ls'); # Prints 'ls', as you'd expect
- $pid = 'ls';
- &foo($pid); # Prints '1', surprise!?
-
- Of course, because @_ contains references to the symbol table, instead of a
- reference to the true value of the parameter. Since perl 5.0 will have
- true references, we can hope this problem will be fixed.
-
- (Note: this is an implementation problem, not a conceptual one. I pointed that
- out to Michael in private e-mail and he replied that (paraphrasing) Perl
- was 'practical', not conceptual.)
- --
- Raphael Manfredi <ram@eiffel.com>
- Interactive Software Engineering Inc.
- 270 Storke Road, Suite #7 / Tel +1 (805) 685-1006 \
- Goleta, California 93117, USA \ Fax +1 (805) 685-6869 /
-