Checking about gif

2004-02-21 Thread John
I want to test if a file is a gif image or not. Is it practicable using a module?

Re: Checking about gif

2004-02-21 Thread MAC OS X
On 21 Feb 2004, at 19:03, John wrote: I want to test if a file is a gif image or not. Is it practicable using a module? perldoc File::MMagic #!/usr/bin/perl -w use strict; die "Usage: $0 directory\n" unless @ARGV > 0; use File::Find; use File::MMagic; my $mm = File::MMagic->new; find sub {

Re: Checking about gif

2004-02-21 Thread John
s" <[EMAIL PROTECTED]> Sent: Saturday, February 21, 2004 9:09 PM Subject: Re: Checking about gif > > On 21 Feb 2004, at 19:03, John wrote: > > > I want to test if a file is a gif image or not. > > > > Is it practicable using a module? > > perldoc File::MMa

Re: Checking about gif

2004-02-21 Thread John
plain $mm->removeFileExts Removes filename pattern checks. Specify one or more patterns. If no pattern is specified, all are removed. - Original Message - From: "Jerry Rocteur" <[EMAIL PROTECTED]> To: "John" <[EMAIL PROTECTED]> Sent: Saturda

Re: Checking about gif

2004-02-21 Thread MAC OS X
ecified, all are removed. - Original Message ----- From: "Jerry Rocteur" <[EMAIL PROTECTED]> To: "John" <[EMAIL PROTECTED]> Sent: Saturday, February 21, 2004 9:37 PM Subject: Re: Checking about gif Ridiculous post your POD.. On 21 Feb 2004, at 20:25, John wrote:

Re: Checking about gif

2004-02-21 Thread Rob Dixon
John wrote: > > I want to test if a file is a gif image or not. > > Is it practicable using a module? You can check whether a file purports to be a GIF file by checking its first three bytes: my $file = 'filename.gif'; my $type; { open my $fh, $file or die $!; read $fh, $type, 3;

Re: Checking about gif

2004-02-21 Thread R. Joseph Newton
John wrote: > I want to test if a file is a gif image or not. print "filename to check: "; my $filename = ; chomp $filename; open IN, $filename or die "Could not open file to check specs: $!"; binmode IN; my $gif_label; read (IN, $gif_label, 6); chomp $gif_label; if ($gif_label =~ /^GIF8[79]a/) {

Re: Checking about gif

2004-02-22 Thread John
Saturday, February 21, 2004 10:10 PM Subject: Re: Checking about gif > I'm going to top post because it is too long. No need to read the whole > thing. > > I see what you're saying.. > > I'm sorry for my reaction.. > > I've written quite a few scripts since r

Re: Checking about gif

2004-02-22 Thread John
TED]> Sent: Sunday, February 22, 2004 1:07 AM Subject: Re: Checking about gif > John wrote: > > > I want to test if a file is a gif image or not. > > print "filename to check: "; > my $filename = ; > chomp $filename; > open IN, $filename or die "Could n

Re: Checking about gif

2004-02-22 Thread MAC OS X
#!/usr/bin/perl -w use strict; die "Usage: $0 directory\n" unless @ARGV > 0; use File::Find; use File::MMagic; my $mm = File::MMagic->new; find sub { return if -d $_ or -l $_; my $type = $mm->checktype_filename($_); return unless $type =~ /gif/i; print "$File::Find::name: $t