Evans, Steven M wrote:
> I am trying to adapt to Active Perl on the DOS command line from 
> cygwin.  I’ve tried to get File:DosGlob to work on my system (this 
> script works on a co-worker’s system, but not mine), but does not work 
> as expected.

Please post in plain text only.

> When I run the script fileglob.pl, @ARGV seems to get lost.
> 
...
> 
> Run as fileglob.pl:
> 
> C:\Unix\dev>fileglob.pl *.pl
> 
> foo
> 
> Put perl in front of it and it works as expected:
> 
> C:\Unix\dev>perl fileglob.pl *.pl

...

> Why won’t the first call work?
> 
> Here’s my environment settings:
> 
> C:\Unix\dev>perl fileglob.pl *.pl
> 
...
> 
> C:\Unix\dev>assoc .pl
> 
> .pl=PerlScript
> 
> C:\Unix\dev>ftype PerlScript
> 
> PerlScript="C:\Program Files\Perl\bin\perl.exe" %1 %*

Try this one with only two real changes:

use strict;
use warnings;

if ($^O eq "MSWin32") {         # note eq vs ==
        require File::DosGlob;  # require vs use prevents loading
        @ARGV = map {
                my @g = File::DosGlob::glob($_) if /[*?]/;
                @g ? @g : $_;
        } @ARGV;
}

foreach my $filename (@ARGV) {
        print "$filename\n";
}

__END__
_______________________________________________
ActivePerl mailing list
[email protected]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Reply via email to