in reply to Re: perl's glob function - argument passing
in thread perl's glob function - argument passing
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:
So, it appears to be the "main routine"./* * 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. */
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:
Note the comment: 1024 is considered "large".# define MAXPATHLEN 1024 /* Err on the large side. */
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.
|
|---|