jettero has asked for the wisdom of the Perl Monks concerning the following question:

@a = <*.c>; # is completely broken on my favorite CGI server.
I've been using File::KGlob as a replacement. I finally figured out the problem! The internal globing uses tcsh. My admin broke tcsh... long story. Anyhoo, is there any way to change the internal globing shell?

Replies are listed 'Best First'.
Re: Glob Me (well
by merlyn (Sage) on Jul 28, 2000 at 16:44 UTC
RE: Glob Me (well, bash me)
by chip (Curate) on Jul 28, 2000 at 22:50 UTC
    Randal's right ... you can't change the glob shell without recompiling Perl.

    However, if you combine File::KGlob with assignment to *CORE::GLOBAL::glob, you have just about as good a substitute for recompilation as you're likely to find.

        -- Chip Salzenberg, Free-Floating Agent of Chaos

      I think via:
      *CORE::GLOBAL::glob= \&File::KGlob::glob;
      and, yes, it should change the way <*.c> behave everywhere. This is just the type of thing that I couldn't do in File::KGlob when I wrote it and that I should add to File::KGlob since it still seems to be of use.
      how do ya do that? and will it replace the original <*.c> functionality?
Re: Glob Me (well
by maverick (Curate) on Jul 28, 2000 at 21:00 UTC
    Well, you could also use:
    opendir(DIR,"/some/dir") || die "can't open: $!"; @files = grep { /\.c$/ } readdir(DIR); closedir(DIR);
    Which if I'm not mistaken is basically what File::KGlob does internally.

    Update: or you could do something truely sick like:

    @files = `/bin/bash -c "ls /some/dir/*.c"`;
    Sorry, couldn't resist... :)

    /\/\averick