Subject: | File not resolved properly without a space in the path |
The parse_html_file method dies with "HTTP response code was not 200 OK. (Set $opts{ignore_http_response_code} to ignore this error.)" if the input file path does not have a space:
use HTML::HTML5::Parser;
my $parser = HTML::HTML5::Parser->new;
my $doc = $parser->parse_html_file('C:\no\space\foo.html'); #dies
# my $doc = $parser->parse_html_file('C:\some space\bar.html');#doesn't die
The problem is with Parser.pm line 44. It checks if the path matches a regex (which doesn't allow spaces in it), and if it does then you call URI->new instead of URI::file->new_abs. For files, apparently URI::file->new_abs is the way to go, but this doesn't happen unless there's a space in the file name.
For now my work around is $parser->parse_html_file(URI::file->new_abs('C:\no\space\foo.html'))