roperl has asked for the wisdom of the Perl Monks concerning the following question:
Or check that it matches application/octet-stream MIME type like so:if(-T $file) { print "$file is an ascii text file \n"; } else { print "Not an ascii text file \n"; }
my $ft = File::Type->new(); my $type = $ft->mime_type($file); if ( $type eq "application/octet-stream" ) { do this.. } else { do that.. }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Perl -T vs Mime::Types
by afoken (Chancellor) on Sep 19, 2017 at 19:38 UTC | |
by AnomalousMonk (Archbishop) on Sep 20, 2017 at 00:43 UTC | |
|
Re: Perl -T vs Mime::Types
by Athanasius (Archbishop) on Sep 20, 2017 at 07:03 UTC | |
|
Re: Perl -T vs Mime::Types
by ateague (Monk) on Sep 20, 2017 at 13:27 UTC | |
by roperl (Beadle) on Sep 20, 2017 at 15:05 UTC | |
by ateague (Monk) on Sep 20, 2017 at 21:33 UTC | |
by roperl (Beadle) on Sep 21, 2017 at 18:34 UTC | |
|
Re: Perl -T vs Mime::Types
by RonW (Parson) on Sep 21, 2017 at 23:37 UTC |