APM: Question: How to access command line before its parsed into @ARGV

Tim Peoples tim at toolman.org
Thu Aug 25 06:47:07 PDT 2005


How about:

   $cmdline = join(' ', map { (/\s/) ? "\"$_\"" : $_ } @ARGV);

The reason you're not getting the quotes in Perl is because they
aren't there; the shell has already removed them in order to parse
the command line into an array of strings.  The quotes are merely
a shell device to tell it not to separate the tokens on whitespace
and to treat the whole quoted string as one token.

I think this begs the quetion of, "Why are you wanting to recombine
your command line into a single string?"  The tokens are already
parsed for you.

Tim.

On Wed, 2005-08-24 at 20:26 -0700, Bill Raty wrote:
> Thanks for the inputs.  Update:
> 
>   $ENV{'CMD_LINE'} - can't repro on either WinXP64 or AIX
> 
>   GetOpt::Long - has a specific caveat blaming CLI
> 
> I'm still searching.
> 
> 
> 
> -Bill
> Reintarnation: Coming back to life as a hillbilly
> 
> _______________________________________________
> Austin mailing list
> Austin at pm.org
> http://mail.pm.org/mailman/listinfo/austin
-- 



More information about the Austin mailing list