1URI::data(3)          User Contributed Perl Documentation         URI::data(3)
2
3
4

NAME

6       URI::data - URI that contains immediate data
7

SYNOPSIS

9        use URI;
10
11        $u = URI->new("data:");
12        $u->media_type("image/gif");
13        $u->data(scalar(`cat camel.gif`));
14        print "$u\n";
15        open(XV, "|xv -") and print XV $u->data;
16

DESCRIPTION

18       The "URI::data" class supports "URI" objects belonging to the data URI
19       scheme.  The data URI scheme is specified in RFC 2397.  It allows
20       inclusion of small data items as "immediate" data, as if it had been
21       included externally.  Examples:
22
23         data:,Perl%20is%20good
24
25         data:image/gif;base64,R0lGODdhIAAgAIAAAAAAAPj8+CwAAAAAI
26           AAgAAAClYyPqcu9AJyCjtIKc5w5xP14xgeO2tlY3nWcajmZZdeJcG
27           Kxrmimms1KMTa1Wg8UROx4MNUq1HrycMjHT9b6xKxaFLM6VRKzI+p
28           KS9XtXpcbdun6uWVxJXA8pNPkdkkxhxc21LZHFOgD2KMoQXa2KMWI
29           JtnE2KizVUkYJVZZ1nczBxXlFopZBtoJ2diXGdNUymmJdFMAADs=
30
31       "URI" objects belonging to the data scheme support the common methods
32       (described in URI) and the following two scheme-specific methods:
33
34       $uri->media_type( [$new_media_type] )
35           Can be used to get or set the media type specified in the URI.  If
36           no media type is specified, then the default
37           "text/plain;charset=US-ASCII" is returned.
38
39       $uri->data( [$new_data] )
40           Can be used to get or set the data contained in the URI.  The data
41           is passed unescaped (in binary form).  The decision about whether
42           to base64 encode the data in the URI is taken automatically, based
43           on the encoding that produces the shorter URI string.
44

SEE ALSO

46       URI
47
49       Copyright 1995-1998 Gisle Aas.
50
51       This library is free software; you can redistribute it and/or modify it
52       under the same terms as Perl itself.
53
54
55
56perl v5.36.0                      2023-01-20                      URI::data(3)
Impressum