If you read the glob documentation, you see that it is implemented (since perl 5.6) by File::Glob. There, you read that it's implemented "in terms of" File::Glob's bsd_glob routine. But apparently there's a functional difference between glob and bsd_glob: the former considers its argument to be one or more whitespace-sepearated patterns, whereas the latter considers it a single argument, even if it includes whitespace. So I wonder: does this long path you have contain any spaces?
If so, try loading File::Glob and using its bsd_glob routine instead.
Another avenue would be to try another module which provides an alternative glob, such as File::DosGlob and FastGlob.
(All these modules let you override the core glob with their version, if you want.)
A word spoken in Mind will reach its own level, in the objective world, by its own weight
| [reply] [d/l] [select] |
That's only part of the story.
Even though I'm no C expert, I did some hunting around in the internals of File::Glob. bsd_glob calls doglob. In addition, the module uses XSLoader, so, it's an XS module. :) Looking at the current source of Glob.xs, doglob in turn calls the C function (not an XS function) bsdglob, which in turn can be found in bsd_glob.c. In turn, that calls the C function glob0, in the same source file. Are you still with me? Now the documentation for glob0 says:
/*
* The main glob() routine: compiles the pattern (optionally processin
+g
* quotes), calls glob1() to do the real pattern matching, and finally
* sorts the list (unless unsorted operation is requested). Returns 0
* if things went well, nonzero if errors occurred. It is not an erro
+r
* to find no matches.
*/
So, it appears to be the "main routine".
Now, and this is the interesting part: it allocates buffers with a length MAXPATHLEN. This constant is defined in perl.h, and it's platform dependent. Anyway, usually this constant is an IMO rather small number, as the code comments there state:
# define MAXPATHLEN 1024 /* Err on the large side. */
Note the comment: 1024 is considered "large".
Now, to answer the OP's question: yes, it looks like there's a built in limit on the length of the strings that glob will return, but the exact maximum value depends on your platform.
And I'm not sure I did all of my homework well, I might still have overlooked something essential.
| [reply] [d/l] [select] |
On reading glob and File::Glob, there seems to be no hard limit on the length of the pattern. There is a possible limit if you call for it explicitly via bsd_glob($pat, GLOB_LIMIT) but this is about the glob expansions and not the argument.
As pointed out in a previous reply, maybe you should avoid the specials of the glob function (like POSIX compliance and split on whitespace) by using bsd_glob directly. Also make some experiments by changing to a directory in Clearcase MVFS directory and expanding a shorter relative path. Maybe it is not working for other reasons, like permissions.
| [reply] [d/l] [select] |
if you have a shell, does it work the way you expect on this directory?
does the pattern used with perl glob make a difference? and in the shell?
if glob is not enough, you might pipe-in the output of the ls (or equivalent) command (or even get it all in one go with qx{...})
open $globbing, "ls -1a |" or die;
while (<$globbing>) {
chomp
filter;
...
}
hth
--stephan
| [reply] [d/l] |