"Henderson, Jordan (Contractor) (DAASC)" <[EMAIL PROTECTED]> wrote
on 12/06/2003 02:12:36 PM:

> My 2 cents.
>
> I would prefer that glob, being a core function, be as close as possible
in
> semantics between VMS and other systems.  This will ease, but not
eliminate
> issues with, portability of Perl code between VMS and other systems.
>
> Of course, glob() on VMS being based on lib$find_file() does mean that
the
> semantics are different, but note that the workarounds you mention will
work
> when perl code running on VMS is ported directly to other systems (modulo
the
> VMS directory/file semantics itself).  The VMS directory/file semantics
are
> issues that jump out at a potential porter, the filename/wildcard
> list are less
> obvious, I think.
>
> If a f$search-like capability is desired, then a VMS:: module should
> probably be
> instituted that includes this capability.

Jordan,

Your concern is certainly an important one.  I think that our
current lack of a fast glob() that allows for filtering files
in a single pass through a directory actually means that the
current vmsperl implementation is less like other platforms.
Note that on linux if I run the following from a perl source
tree:

$ ./perl -Ilib -e '@f=glob("*.c *.h"); print "$#f\n"'
90

But on VMS, using either the more VMS native comma separator
or the more Unix-ish space character, I find:

$ perl -e "@f=glob('*.c *.h'); print $#f"
-1
$ perl -e "@f=glob('*.c,*.h'); print $#f"
-1

But I can obtain an answer (that at 93 exceeds the linux one
owing to copying things like vmsish.h, vms.c, and sockadap.h into
the source directory by descrip.mmms) in two passes:

$ perl -e "@f=glob('*.c'); print $#f"
39
$ perl -e "@f=glob('*.h'); print $#f"
54

There are some important portability points worth noting:
I had to use -Ilib on linux to be able to load File::Glob from
an uninstalled perl source directory whereas the calls to lib$find_file
embedded within vmsperl did not require loading of lib/File/Glob.pm.
The matter of whether to use spaces or commas as a separator
is probably an imporant consideration that is likely subject
to personal preference.

Peter Prymmer

Reply via email to