New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
inconsistencies in glob: File nonexistent OK; Directory nonexistent FAIL #751
Comments
From aberry@tiuk.ti.comIf I use glob to match a series of wildcards it appears to work as I want example : @files = glob "/user/a/*.txt /home/a/*.txt"; case 1: /user/a/fred.txt exists, /home/a exists but there are no *.txt matches. This works and returns ("/user/a/fred.txt") in @fred. case 2: /user/a/fred.txt exists, /home/a does not exist @files returns as an empty array. Surely glob should still return the /user/a/*.txt match ? So in summary, the whole glob "fails" if one of the directories in any of the FYI I also got the same behaviour with 5.004_04 Site configuration information for perl 5.003: Configured by a904209 at Tue Nov 26 14:18:36 GMT 1996. Summary of my perl5 (5.0 patchlevel 3 subversion 0) configuration: |
From [Unknown Contact. See original ticket]
% mkdir user home user/a % perl -le 'for (glob("{home,user}/a/*.text")) { print }' % ls -R home: user: user/a: That's the same in 5.005_61, and in 5.005_62 with -DPERL_INTERNAL_GLOB. --tom |
From [Unknown Contact. See original ticket]Tom,
Thanks for the solution to my example. Perhaps I should have illustrated glob "/adir/xdir/*.lic /adir/ydir/something.dat /home/bdir/cdir/*/etwas.dat /home/kdir/ldir/mdir/afile.ext" i.e. some set of wildcards not easily represented as one wildcard. BTW, I changed my code to build up the list of matches from multiple calls to Regards, Andy |
From [Unknown Contact. See original ticket]aberry@ti.com writes:
This *should* match files with names starting with "/adir/" etc. and This may be not how the current (broken) implemenation is/was working, One can use @files = map glob, qw(/adir/xdir/*.lic if the older semantic is needed. Ilya |
From [Unknown Contact. See original ticket]On Thu, 21 Oct 1999 16:41:59 -0400 (EDT)
s/broken/unfortunate/
Well, I think you're probably right (No, you may not use But I wonder a bit.... % touch "this file" this file % perl5.004 -e 'for(glob("*this* *file*")) { printf "%d: %s\n", $i++, $_ }' % perl5.005_62 -e 'for(glob("*this* *file*")) { printf "%d: %s\n", $i++, $_ }' And yes, that's with -DPERL_INTERNAL_GLOB. I'm not getting What happened to glob("*this*", "*file*")? % perl -e 'for(glob("*this*", "*file*")) { printf "%d: %s\n", $i++, $_ }' Hm... that looks wrong. I think it ignored the second argument. You know, Unix has had ability to put spaces in filenames for what, -tom |
From [Unknown Contact. See original ticket]On Thu, Oct 21, 1999 at 03:14:56PM -0600, Tom Christiansen wrote:
This may be related to the fact that most of what these *nix machines
Usability of shells for non-administrative tasks is greatly I think a lot of people (even if we restrict our attention to those IDE are very restrictive, but as far as they answer your needs, you do Ilya |
Migrated from rt.perl.org#1675 (status was 'resolved')
Searchable as RT1675$
The text was updated successfully, but these errors were encountered: