The manakai project

Web::Transport::DataURL

A data: URL struct

SYNOPSIS

  use Web::Transport::DataURL;
  
  $mime = $parser->parse_string ('text/plain; charset=utf-8');
  $body = "body byte sequence";
  
  $data = Web::Transport::DataURL->new_from_mime_and_scalarref ($mime, \$body);
  is $data->mime_type, $mime;
  is ${$data->body_ref}, $body;

DESCRIPTION

The Web::Transport::DataURL class represents data: URL struct.

METHODS

$data = Web::Transport::DataURL->new_from_mime_and_scalarref ($mime, $ref)

Create a new data: URL struct and return it.

The first argument must be a MIME type (a Web::MIME::Type object). The data: URL struct's MIME type is set to the argument.

The second argument must be the reference to a scalar value that is a byte string. The data: URL struct's body is set to the scalar value. After the invocation of the method, the application should not modify the scalar.

$mime = $data->mime_type

Return the MIME type object of the data: URL struct.

$ref = $data->body_ref

Return the reference to the body of the data: URL struct.

SPECIFICATION

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.