On Sun Sep 22 02:28:24 2013, Hugmeir wrote: > Actually. I've hit a bit of a snag here. How come bsd_glob() doesn't keep > state? > > use 5.010; > use File::Glob qw(bsd_glob csh_glob); > > say "Default glob:"; > say scalar glob("*") for 1..3; > > say "\nbsd_glob:"; > say scalar bsd_glob("*") for 1..3; > > say "\ncsh_glob:"; > say scalar csh_glob("*") for 1..3; > > __END__ > Default glob: > base > benchmark > bigmem > > bsd_glob: > x2p > x2p > x2p > > csh_glob: > base > benchmark > bigmem > > > Also, by doing a 'use File::Glob qw(:bsd_glob)', CORE::glob gets replaced > with bsd_glob_override(), which does keep state. So bsd_glob() sometimes > keeps state? > > I can work around this by using csh_glob in those tests, which both keeps > state and returns the results sorted alphabetically, but I don't quite grok > how this is all supposed to work. It’s an historical mess. It used to be that keeping state and splitting the pattern went hand in hand. There was no way to bypass skipping the pattern *and* have it keep state. I suggested adding the :bsd_glob tag (since bsd_glob was known not to split), which got support on the list, so I added it. It makes <...> bypass splitting. But File::Glob’s interface was a confusing mess to begin with, and we can’t clean it up to begin with. -- Father Chrysostomos --- via perlbug: queue: perl5 status: open https://rt.perl.org:443/rt3/Ticket/Display.html?id=119897Thread Previous | Thread Next