Re: typing files quickly

2003-06-10 Thread Harry Putnam
"Rob Dixon" <[EMAIL PROTECTED]> writes: > No. I wrote the code to derive the file type from an 'lstat' > call in a previous post and thought you were happy with that. Yes, I was happy with it. It does all I need. Further ponderings weren't really related to what I'm doing with it. You've solved

Re: typing files quickly

2003-06-10 Thread Steve Grazzini
Harry Putnam <[EMAIL PROTECTED]> wrote: > Steve Grazzini <[EMAIL PROTECTED]> writes: >> Harry Putnam <[EMAIL PROTECTED]> wrote: >>> >>> I've seen that `_' crop up before >>> I don't understand what this means. >> >> It's documented in perlfunc: > > Yes, I saw it there too. I must be having a par

Re: typing files quickly

2003-06-10 Thread Mark G
times using _'); $t->report; # using stat on each test $t->start('1 times using stand'); eval $without_; $t->stop('1 times using stand'); $t->report; <~~ Paste - Original Message - From: "Rob Dixon" <[EMAIL PROTECTED]> T

Re: typing files quickly

2003-06-10 Thread Rob Dixon
Harry Putnam wrote: > Steve Grazzini <[EMAIL PROTECTED]> writes: > > > Harry Putnam <[EMAIL PROTECTED]> wrote: > > > "Janek Schleicher" <[EMAIL PROTECTED]> writes: > > > > > > > > The underscore _ holds the results of the last stat call > > > > (implicitly called by the -f operator), so no unnecess

Re: typing files quickly

2003-06-10 Thread Harry Putnam
Steve Grazzini <[EMAIL PROTECTED]> writes: > Harry Putnam <[EMAIL PROTECTED]> wrote: >> "Janek Schleicher" <[EMAIL PROTECTED]> writes: >>> >>> The underscore _ holds the results of the last stat call >>> (implicitly called by the -f operator), so no unnecessary >>> work needs to be done. >> >>

Re: typing files quickly

2003-06-09 Thread Steve Grazzini
Harry Putnam <[EMAIL PROTECTED]> wrote: > "Janek Schleicher" <[EMAIL PROTECTED]> writes: >> >> The underscore _ holds the results of the last stat call >> (implicitly called by the -f operator), so no unnecessary >> work needs to be done. > > I've seen that `_' crop up before > I don't understan

Re: typing files quickly

2003-06-09 Thread Harry Putnam
"Janek Schleicher" <[EMAIL PROTECTED]> writes: > Well, yes of course I can run each filename thru all those tests, but that >> seems kind of like a lot of huffing and puffing. I wondered if there >> isn't something that just spits it out. >> >> perl `stat' does do that very thing in element[2]

Re: typing files quickly

2003-06-09 Thread Janek Schleicher
Harry Putnam wrote at Sat, 07 Jun 2003 02:18:32 -0700: >> So you can use: >> >> if (-f $file) { >> : >> # process file >> } >> elsif (-d $file) { >> : >> # process directory >> } >> } > Well, yes of course I can run each filename thru all those tests, but that > seems kin

Re: typing files quickly

2003-06-07 Thread Harry Putnam
"Rob Dixon" <[EMAIL PROTECTED]> writes: Thanks for the good description of the reasons for `my %types' > Yes. My apologies - I'm travelling at the moment and I have no Unix > system with me to test on. Change that line to use 'lstat' instead: > > my $type = (lstat $file)[2] & S_IFMT; Yeah, now

Re: typing files quickly

2003-06-07 Thread Harry Putnam
"R. Joseph Newton" <[EMAIL PROTECTED]> writes: > If you can tell us a little more about the context and sense in which you > are seeking file type information, we may be able to help you find the > distinctions appropriate to that context. First... point taken about the bit-anding. But as you sa

Re: typing files quickly

2003-06-07 Thread R. Joseph Newton
Harry Putnam wrote: > Probably a no-brainer, but I wondered what is the canonical way or > possibly a module that does this chore: > > Identify files by type similar to `-type' flag to unix `find' command. > I first thought of the stat function, but I see I'm confused about > what that does. None

Re: typing files quickly

2003-06-07 Thread Rob Dixon
Harry Putnam wrote: > "Rob Dixon" <[EMAIL PROTECTED]> writes: > > > > This code will build a map of 'stat' type values to the seven type > > operators that you list. Not all of them may be active on your system. > > You can obviously modify the code to return the value you want. > > You need to imp

Re: typing files quickly

2003-06-07 Thread Harry Putnam
"Rob Dixon" <[EMAIL PROTECTED]> writes: > > This code will build a map of 'stat' type values to the seven type > operators that you list. Not all of them may be active on your system. > You can obviously modify the code to return the value you want. > You need to import the symbolic mode values usi

Re: typing files quickly

2003-06-07 Thread Rob Dixon
Harry Putnam wrote: > "Rob Dixon" <[EMAIL PROTECTED]> writes: > > > So you can use: > > > > if (-f $file) { > > : > > # process file > > } > > elsif (-d $file) { > > : > > # process directory > > } > > Well, yes of course I can run each filename thru all those tests, but > t

Re: typing files quickly

2003-06-07 Thread Harry Putnam
"Rob Dixon" <[EMAIL PROTECTED]> writes: > So you can use: > > if (-f $file) { > : > # process file > } > elsif (-d $file) { > : > # process directory > } Well, yes of course I can run each filename thru all those tests, but that seems kind of like a lot of huffing and puff

Re: typing files quickly

2003-06-07 Thread Rob Dixon
Harry Putnam wrote: > Probably a no-brainer, but I wondered what is the canonical way or > possibly a module that does this chore: > > Identify files by type similar to `-type' flag to unix `find' command. > I first thought of the stat function, but I see I'm confused about > what that does. None

typing files quickly

2003-06-07 Thread Harry Putnam
Probably a no-brainer, but I wondered what is the canonical way or possibly a module that does this chore: Identify files by type similar to `-type' flag to unix `find' command. I first thought of the stat function, but I see I'm confused about what that does. None of the array elements are about