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 of the array elements are about type.
File types are system-specific. Although there are certain standards that commensurate across systems, the criteria for assignment to one type or another are matters of judgement that vary among systems. Consider a Perl script. What kind of animal is it? From one perspective, you could call it an executable, since the purpose of the script is to execute some process. From another perspective, a Perl script can be seen as a data file, providing the information used by an executable, the perl interpreter, to carry out the intended process. On a well-designed, stable operating system, it could be said that the OS kernel itself is the only real executable, and that all services, devices drivers and applications are data which that OS uses to run the machine and respond to user input. > > > One of them `mode' claims to be about `type' but I'm not conversant > with the numeric output of that element. And it doesn't seem to be > explained in language spoken by mortals in perldoc -f stat > All the gobbledeegook about bit-anding masking etc Whoa, hold the phone here! Gobbledeegook? Uh-uh. Say instead, basic tool that any serious programmer should at least understand on a conceptual level. Consider the fact that this message reaches your computer at all. For that to happen, processes all along the path have to mask offf protions of the IP address to resolve network and host numbers. Likewise, if you are using any form of Wiunodws, the vast majority of the signals passed between processes come in the form of bit-packed flags, which are interpreted through bit-masking. > would be rendered > unecessary by an (often omitted) simple example. > There is an example showing how to get the permissions from $mode but > I couldn't begin to reverse engineer it to get type. > > Maybe File::Find has an option but I don't find it in the docs. > > Along with this `typing' action I wondered if there is a perl > equivalent to unix `file' command. > > I browsed all the modules turned up with a search string of > > file type > on cpan, but none revealed this functionality. At least not in a > hasty scan. 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. Joseph -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]