From Code to Community: Sponsoring The Perl and Raku Conference 2025 Learn more

use 5.016;
our $VERSION = '1.06';
use strict;
sub heuristic {
my $class = shift;
my $file = shift;
my $fh = shift;
return 1 if $file =~ /\.xhtml?$/;
return 0 unless -T $fh;
read $fh, my ($head), 1024;
return 0 unless $head =~ /<[^<>]+xmlns\s*=\s*"\Q$XHTML_NS\E"[^<>]*>/;
return $head =~ /<\s*html[^<>]+>/;
}
1;