From: Peter Scott <[EMAIL PROTECTED]>
> At 07:50 PM 7/8/02 -0700, charlie strauss wrote:
> >as you know, when a perl command runs the arguments on the command
> >line are split on whitespace and placed in @ARGV
> >
> >What I want instead is to know the exact input command line, before
> >it is split on white space.
> 
> You can't do this.  The shell does the whitespace splitting and 
> dequoting before the program sees the arguments.  It makes no 
> difference what language the program is written in.  Your only hope is
> to use some kind of lobotomized shell that doesn't do any of that.  I
> don't know of one, but in any case I doubt that you're in a position
> to dictate the shell.  Better find another approach.

Well ... you are right ... but only on certain OSes. If your are 
running some version of Unix, the you are right that the shell parses 
the parameters, globs them (processes the wildcards) and passes the 
list to the process.

On the other hand under Windows (unless you are using cygwin) the 
shell only processes the redirections and similar stuff and passes 
the rest to the process UNMODIFIED. The process then splits the 
command line anyway it pleases.

You can access the unparsed command line using the GetCommandLine() 
Win32 API function. From Perl you can do that like this:

        use Win32::API;
        my $GetCommandLine = Win32::API->new('kernel32', 
                'GetCommandLine', [ ] , 'P' );
        $cmdline = $GetCommandLine->Call();

I cannot speak about other OSes, but I'd think it's more likely 
they'll work the Unix way.

Jenda
=========== [EMAIL PROTECTED] == http://Jenda.Krynicky.cz ==========
There is a reason for living. There must be. I've seen it somewhere.
It's just that in the mess on my table ... and in my brain
I can't find it.
                                        --- me


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to