On Fri, Mar 21, 2003 at 01:38:10PM -0800, Paritosh Tyagi wrote:
> Here's a suggestion - 
>    line 141 of PAR.pm of my package (PAR 0.65) is
>        foreach my $par (@_) {
>    If you introduce globing on the variable -
>        foreach my $par (<@_>) {
>     
> then we can use, 
> use PAR "par/*.par"; or PERL5OPT="-MPAR=par/*.par"
> and read multiple par files from one dir w/o
> having to specify them by name (sort of the include
> path idea).

Good idea.  However it breaks when the filename(s) have spaces in them.

I'll change it to:

        foreach my $par (map { /[?*{}\[\]]/ ? eval 'glob($_)' : $_ } @_) {

but it will also break if somebody named their PAR files with names
like "abc[def].par"... I don't know which is more rare: a glob pattern
containing []{} characters, or a PAR filename containing such characters.
I'll go with the latter assumption, but if somebody depends on such
PAR files, I can easily be pursuaded to change it to

        foreach my $par (map { /[?*]/ ? eval 'glob($_)' : $_ } @_) {

instead.  The reason of the eval() is that Perl automagically pulls in
File::Glob upon seeing glob(); and since pp-generated stand-alone
executables does not include File::Glob in its bootstrap libraries
currently, I think there's no reason to inflict it upon the exe files
since they will not be using the globbing feature.

Thanks,
/Autrijus/

Attachment: pgp00000.pgp
Description: PGP signature

Reply via email to