At 07:50 AM 1/31/01 -0500, Chris Nandor wrote:
>I've never really thought about this before, but it is an interesting
>problem and solution. What are the issues involved in "re-executing" a
>script? How is that re-execution done?
On UNIX it's straightforward: "exec $^X ,$0, @ARGV" out of a BEGIN clause.
On Windows I do "exit system $^X ,$0, @ARGV", though since Perl's system()
always exposes its argument to the shell it's necessary to do some quoting
first and as a corollary there are probably some pathological cmdlines for
which it will fail. I've only attempted to address UNIX and Windows so far
(I only wrote it last night!) but will probably put in a check to fail
gracefully on the Mac, or would gladly accept a patch to make it work there.
I guess I should document that Env::Reject should be the first module use'd
so no other BEGIN gets in there and does real work before the re-exec.
The full package is at
ftp://ftp.cleartool.com/pub/Perl/Env-Reject-0.01.tar.gz for now. Note that
in my case "product X" is ClearCase which bundles an incredibly archaic
5.001 build so I had to write the code to work with 5.001.
-David Boyce