use strict use warnings use File LibMagic wget http zhumarin ru tmp te

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
use strict;
use warnings;
use File::LibMagic;
`wget "http://zhumarin.ru/tmp/test.webp" -O "/tmp/test_libmagic.png"`;
my $ft = File::LibMagic->new('/etc/magic');
my $screen_body;
open FH, "</tmp/test_libmagic.png";
read FH, $screen_body, -s "/tmp/test_libmagic.png";
close FH;
print $ft->describe_contents(substr($screen_body, 0, 1024));