URI::data3pm
Uri that contains immediate data
Usage
use URI;$u = URI->new("data:");$u->media_type("image/gif");$u->data(scalar(`cat camel.gif`));print "$u\n";open(XV, "|xv -") and print XV $u->data;
Overview
The "URI::data" class supports "URI" objects belonging to the data URI scheme. The data URI scheme is specified in RFC 2397. It allows inclusion of small data items as "immediate" data, as if it had been included externally. Examples:
data:,Perl%20is%20gooddata:image/gif;base64,R0lGODdhIAAgAIAAAAAAAPj8+CwAAAAAIAAgAAAClYyPqcu9AJyCjtIKc5w5xP14xgeO2tlY3nWcajmZZdeJcGKxrmimms1KMTa1Wg8UROx4MNUq1HrycMjHT9b6xKxaFLM6VRKzI+pKS9XtXpcbdun6uWVxJXA8pNPkdkkxhxc21LZHFOgD2KMoQXa2KMWIJtnE2KizVUkYJVZZ1nczBxXlFopZBtoJ2diXGdNUymmJdFMAADs=
"URI" objects belonging to the data scheme support the common methods (described in URI) and the following two scheme-specific methods:
- $uri->media_type( [$new_media_type] )
-
Can be used to get or set the media type specified in the URI. If no media type is specified, then the default
"text/plain;charset=US-ASCII"is returned.
- $uri->data( [$new_data] )
-
Can be used to get or set the data contained in the URI. The data is passed unescaped (in binary form). The decision about whether to base64 encode the data in the URI is taken automatically, based on the encoding that produces the shorter URI string.
Releases
14 releases since Debian 2.2 (Potato); the text changed 13 times.