in reply to Re^2: Reliable glob?
in thread Reliable glob?
Hi Rob,
I took a look at the C source for bsd_glob and it does indeed truncate the input pattern in all cases, regardless of what options you use. That said, you're hitting an unusually short maximum buffer size. But that size is compiled into the C code and is not changeable at runtime. So as you suggest above you'll have to find some way to work around this if you're trying to support such platforms.
If you don't mind a CPAN dependency, there are several Perl-only glob implementations on CPAN you could explore. I tried out Text::Glob::Expand and it handled your input string without a problem. Even added a second trailing braces expansion to make it longer, and it was still okay:
use Text::Glob::Expand; my $x = 'cff_updated/1_lib/{A3DWE.1.Solexa-142587.splice.fastq,A3DWE.1 +.Solexa-142588.splice.fastq,A3DWE.1.Solexa-142589.splice.fastq,A3DWE +.1.Solexa-14 2590.splice.fastq,A3DWE.1.Solexa-142594.splice.fastq,A3DWE.1.Solexa-1 +42595.splice.fastq,A3DWE.1.Solexa-142596.splice.fastq,A3DWE.1.Solexa +-142597.splice.fastq,A3DWE.1.Solexa-142598.splice.fastq,A3DWE.1.Solex +a-142599.splice.fastq,A3DWE.1.Solexa-142600.splice.fastq,A3DWE.1.Sol +exa-142602.splice.fastq,A3DWE.1.Solexa-142603.splice.fastq,A3DWE.1.S +olexa-142605.splice.fastq,A3DWE.1.Solexa-142606.splice.fastq,A3DWE.1 +.Solexa-142607.splice.fastq,A3DWE.1.Solexa-142608.splice.fastq,A3DWE. +1.Solexa-142609.splice.fastq,A3DWE.1.Solexa-142610.splice.fastq,A3DW +E.1.Solexa-142611.splice.fastq,A3DWE.1.Solexa-142612.splice.fastq,A3 +DWE.1.Solexa-142613.splice.fastq,A3DWE.1.Solexa-142614.splice.fastq, +A3DWE.1.Solexa-142615.splice.fastq,A3DWE.1.Solexa-142616.splice.fastq +,A3DWE.1.Solexa-142617.splice.fastq,A3DWE.1.Solexa-142618.splice.fas +tq,A3DWE.1.Solexa-142619.splice.fastq,A3DWE.1.Solexa-142621.splice.f +astq}{.drp,.fna,.lib}'; my @y = map { $_->text } @{Text::Glob::Expand->parse($x)->explode}; print "Number of items: ", scalar @y, $/, join($/,@y);
In any case, hope you find a relatively painless way to deal with this. Cheers.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^4: Reliable glob?
by hepcat72 (Sexton) on Oct 28, 2014 at 15:02 UTC |