On Thu, Nov 20, 2008 at 5:50 PM, Raymond Wan <[EMAIL PROTECTED]>wrote:
> > Hi Amit, > > > Amit Saxena wrote: > >> On Thu, Nov 20, 2008 at 4:59 PM, Raymond Wan <[EMAIL PROTECTED] >> >wrote: >> >> >>> Hi Amit, >>> >>> Amit Saxena wrote: >>> >>> >>>> Hi all, >>>> >>>> How to determine the file type of a file passed as an input to the perl >>>> program ? >>>> >>>> I want to have the same output as it's shown by "file" command in UNIX. >>>> >>>> >>> Try going to CPAN and searching for it. For example, >>> >>> http://search.cpan.org/search?query=file+type&mode=all >>> >>> Several options come up. See which one seems easiest to use.. >>> >> Hi Ray, >> >> Before posting this query here, I indeed did a sample search on CPAN. >> >> However I want to have a solution using Perl inbuilt module instead of >> some >> external module as the system I am working on does not allows perl >> external >> modules to be installed. >> >> If you have use such modules, please suggest the one which is inbuilt in >> Perl and best for this scenario ? >> >> > > Oh! Then you should be more specific and mention that you searched CPAN > already. > > In-built? You mean that it is part of the Perl language? I'm not sure if > there is one; perhaps someone else can help you -- but if there was one, > then people would not have developed external ones and put them on CPAN. At > least, that's what I would expect... > > If you are in a shared environment, perhaps you should look into installing > external Perl modules in your local home directory instead? Is that > disallowed as well? > > Ray > > > Hi Ray, Using external modules in the home directory is not disallowed, in fact I keep using few CPAN modules from my home directory like PerlTidy etc. However the reason for which I want to use an inbuilt module because I need not ask sysadmin people to download and install an external module just for my requirement. I tried even looking for UNIX utility "stat" (it even has a Perl API) but it's not giving me what I want. If I don't get any module like this, I will be forced to use system ("file") which I don't want to use. Thanks & Regards, Amit Saxena