or download this
my $magic = File::MMagic->new ( # -f $self->{'magicmime'}
# ? $self->{'magicmime'}
...
$self->{'&discard'} = sub { 'text/' ne substr($magic->checktype_co
+ntents(@_[0]), 0, 5) };
# Same, to return the complete MIME type
$self->{'&mimetype'} = sub {$magic->checktype_contents(@_[0])};