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.


In reply to Re^2: perl's glob function - argument passing by bart
in thread perl's glob function - argument passing by jesuashok

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.