| 1 | package EBook::Ishmael::EBook::XHTML; | ||||||||||
| 2 | 17 | ▶ | use 5.016; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 3 | 17 | our $VERSION = '2.04'; | |||||||||
| 4 | 17 | ▶ | use strict; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 5 | 17 | ▶ | use warnings; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 6 | |||||||||||
| 7 | 17 | ▶ | use parent 'EBook::Ishmael::EBook::HTML'; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 8 | |||||||||||
| 9 | 17 | my $XHTML_NS = 'http://www.w3.org/1999/xhtml'; | |||||||||
| 10 | |||||||||||
| 11 | sub heuristic { | ||||||||||
| 12 | |||||||||||
| 13 | 47 | ▶ | my $class = shift; | ||||||||
|
Subroutine
heuristic: called CC=4 SCAR=14.0
Pod
undocumented
| |||||||||||
| 14 | 47 | my $file = shift; | |||||||||
| 15 | 47 | my $fh = shift; | |||||||||
| 16 | |||||||||||
| 17 | 47 | ▶ | return 1 if $file =~ /\.xhtml?$/; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 18 | 36 | ▶ | return 0 unless -T $fh; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 19 | |||||||||||
| 20 | 12 | read $fh, my ($head), 1024; | |||||||||
| 21 | |||||||||||
| 22 | 12 | ▶ | return 0 unless $head =~ /<[^<>]+xmlns\s*=\s*"\Q$XHTML_NS\E"[^<>]*>/; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 23 | |||||||||||
| 24 | 0 | return $head =~ /<\s*html[^<>]+>/; | |||||||||
| 25 | |||||||||||
| 26 | } | ||||||||||
| 27 | |||||||||||
| 28 | 17 | 1; | |||||||||