The manakai project

Web::Transport::DataURL::Parser

data: URL parser

SYNOPSIS

  use Web::Transport::DataURL::Parser;
  
  $parser = Web::Transport::DataURL::Parser->new;
  $parser->onerror (sub { ... });
  
  $url = Web::URL->parse_string ("data:,...");
  $mime = $parser->parse_url ($url);

DESCRIPTION

The Web::Transport::DataURL::Parser class is a data: URL processor.

METHODS

There are following methods:

$parser = Web::MIME::Type::Parser->new

Create a new parser.

$parser->onerror ($coderef)
$coderef = $parser->onerror

Get or set the error handler for the parser. Any parse error, as well as warning and additional processing information, is reported to the handler. See <https://github.com/manakai/data-errors/blob/master/doc/onerror.txt> for details of error handling.

The value should not be set while the parser is running. If the value is changed, the result is undefined.

$data = $parser->parse_url ($url)

Process a data: URL record (a Web::URL object whose scheme is data) using the data: URL processor and return the data: URL struct (Web::Transport::DataURL). If the process fails, undef is returned instead.

This method is an implementation of the "data: URL processor" of the Fetch Standard.

SEE ALSO

Web::Transport::DataURL.

SPECIFICATIONS

Fetch Standard <https://fetch.spec.whatwg.org/>.

AUTHOR

Wakaba <wakaba@suikawiki.org>.

LICENSE

Copyright 2018 Wakaba <wakaba@suikawiki.org>.

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.