At 11:00 -0500 01.31.2001, David Boyce wrote:
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.
Does this method work OK for mod_perl scripts, etc.?
As to working on a Mac: I am not sure what the best thing to do would be.
It'd probably really need to be some deep voodoo, since there is no exec(),
and system() calls from the application out to the command line tool, which
might not be what you want. I am sure it can be done, but it would likely
need a patch to MacPerl itself in order to get it work, unless there's
something I am not thinking of. But then again, this is not something
really needed on a Mac at this point, that I can think of, so I wouldn't
worry about it. :-)
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.
That'd probably be a good idea, yeah. Unless you _like_ to get the same
question asked of you over and over ... :)
--
Chris Nandor [EMAIL PROTECTED]http://pudge.net/
Open Source Development Network[EMAIL PROTECTED] http://osdn.com/