Brian Raven wrote:

> $Bill Luebkert <> wrote:
> 
>>Except you don't have a choice since autoglob automatically does it -
>>you can't control when it does it or on which args. 
> 
> Good point.
> 
>>On UNIX, you could just do 'some/path/*.txt' and get a mask in
>>instead of expanding the glob.  Autoglob precludes that.
> 
> 
> Well, any parameter that might contain a file-glob meta character. Yes,
> if that is the sort of thing that you want to do then it would be wrong
> to use Autoglob. 

And the original code was doing similar - reading ARGV into a
$filemask vrbl.

        $filemask = glob  ( @ARGV );   # Example: c:\ftp\test*

which of course makes no sense since it should have been an array.

I'm wondering if maybe the orig code was:

        $filemask = shift @ARGV;

before the autoglob was added.

Otherwise he could have just done:

        @filemasks = @ARGV;

and picked up the rest of the files which had already been globbed
by autoglob.  Probably a misunderstanding of how autoglob works.

Personally, I would never use autoglob since it has no provision for
passing ? or * in an argument.  Maybe if it allowed them to be escaped
it would be more useful.  Just another example of not thinking a
problem all the way though.

Maybe someone could suggest to the writer replacing it with something
like this:

        @ARGV = map { defined $_ && m/[^^][\*\?]/ ? sort glob $_ : $_ } @ARGV if
          $^O eq 'MSWin32' and ! $ENV{SHELL};

which should help get around the problem.  It uses ^ to escape the * or ?
like UNIX would use \.





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

Reply via email to