Date: Sun, 18 Jan 2004 16:34:25 -0800 From: Chris Pressey <cpressey@catseye.mine.nu> To: Gary Kline <kline@thought.org> Cc: freebsd-questions@FreeBSD.ORG Subject: Re: OT: Another perl question Message-ID: <20040118163425.6214fb37.cpressey@catseye.mine.nu> In-Reply-To: <20040118235542.GA41663@tao.thought.org> References: <20040118235542.GA41663@tao.thought.org>
next in thread | previous in thread | raw e-mail | index | archive | help
On Sun, 18 Jan 2004 15:55:42 -0800
Gary Kline <kline@thought.org> wrote:
>
> Is there an easy way of determining "file - determine file type"
> in perl? at least as certain as magic(5) can ascertain?
>
> E.g:
>
> if (($ftype = file ($ARV[i])) eq "script){
> ## do abc;
> }
> else if ($ftype eq "Mail"){
> ## do def;
> }
> else if ($type eq "C program"){
> ## do xyz;
> }
> .
> .
> .
>
> I've been poking around perl tutorial sites; so far, nada.
> Thought I'd ask the wizards.
>
> thanks for any clues,
>
> gary
How about /usr/ports/devel/p5-File-MMagic ?
"This module is to guess file type from its contents like file(1)
command."
-Chris
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20040118163425.6214fb37.cpressey>
