develooper Front page | perl.perl5.porters | Postings from August 2001

Re: On "Command-line Wildcard Expansion"

Thread Previous | Thread Next
From:
Jenda Krynicky
Date:
August 7, 2001 15:58
Subject:
Re: On "Command-line Wildcard Expansion"
Message ID:
3B708034.4072.73B631A@localhost
> Jenda Krynicky wrote:
> > 
> > > All I want is something that ships with Perl.  Actually, I
> > > find the arguments for not rolling this into Perl itself very
> > > unconvincing.  I'd prefer @ARGV to have wildcards expanded in the
> > > name of portability and provide Win32::GetCommandLine() for people
> > > who want to write Win32ish command-line interfaces.
> > 
> > Agreed completely.
> 
> I'm using a native tcsh which expands args (within the funky env
> limitations of Windoze.  I don't want any args passed in as '*fubar*'
> to be expanded since they aren't file globs.

You mean

	perl -e "print join(qq{\n}, @ARGV)" '*fubar*'
or
	perl -e "print join(qq{\n}, @ARGV)" *fubar*

> The args need to be selectively globbed based on what they refer to.
> 
> > should be sufficient unless some kind of globbing will be provided
> > by default.
> 
> Only the shell can provide globbing properly, since by the time Perl
> sees the args, I believe they are already stripped of ' and ", etc.

Depends. You can get to the "raw" command line :

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

That is if the shell did not try to help you. You can bypass the C 
runtime, not the shell.

Could you try 

perl - foo.* 'bar.*' "baz   baz" 'hello    world' "see\nyou" see\nyou
use Win32::API;
$GetCommandLine = Win32::API->new('kernel32', 
	'GetCommandLine', [], 'P' ); 
print $GetCommandLine->Call();
^Z

under your tcsh? What do you get? What about bash?

Jenda

== Jenda@Krynicky.cz == http://Jenda.Krynicky.cz ==
: What do people think?
What, do people think?  :-)
             -- Larry Wall in <199808071736.KAA12738@wall.org>

Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About