Show quoted text> -----Original Message-----
> From: Jonathan Scott Duff via RT [mailto:bug-File-SearchPath@rt.cpan.org]
> Sent: יום ו 16 ינואר 2015 20:00
> To: meir@guttman.co.il
> Subject: [rt.cpan.org #97617] Search criteria to be a RegEx
Show quoted text> How would these interact with the filename specified? Would
>
> searchpath('foo', ext => '.pl');
>
> look for "foo" and "foo.pl" (I would guess that this is what's desired) or
> only "foo.pl"?
My intention was just 'foo.pl'
Show quoted text> Also, should it be ext => '.pl' or ext => 'pl' (and a
> period is automatically put between the filename and the "extension")?
I would vote for the latter.
Show quoted text> Also, what's the benefit of the option when you can just say
>
> searchpath('foo.pl'); # ???
>
Indeed, no benefit, if this works. But then, why do we need the 'exe' => 1 clause? Can't we just do:
searchpath('foo.exe');
Show quoted text> Maybe an option to specify multiple filenames to search for would be a
> better way to satisfy the need that this option is trying to fill?
> Perhaps something like
>
>
> searchpath([ 'foo', 'foo.pl' ]); # ???
That can work of course, but I am not sure that the complexity is justified? Aren’t we better off with the RegEx option or when this is not appropriate, calling 'searchpath' multiple times and attaching the results to the array?
Show quoted text>
>
> WRT using a regex ... it seems to me that for this to be useful it would
> have to replace the filename argument (otherwise, what is
> searchpath("foo", qr => qr/blah/) to mean?), perhaps there should be some
> logic to check the type of the first arg and do something different if
> it's a regex:
>
> searchpath(qr/foo.*/); # finds foo, foo.pl, foo.py, libfoo.so, etc.
>
> Or a way to specify that the "filename" is a regex:
>
> searchpath("foo.*", isregex => 1); # same as above.
>
I imagined something like:
my $criteria = qr/foo_\d\d\.pl/;
searchpath ($criteria, isregex => 1); # finds foo_00.pl, foo_01.pl, etc.
Regards,
Meir