man-pages/man3/URI::data.3pm.html
2021-03-31 01:06:50 +01:00

119 lines
2.9 KiB
HTML

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<HTML><HEAD><TITLE>Man page of URI::data</TITLE>
</HEAD><BODY>
<H1>URI::data</H1>
Section: User Contributed Perl Documentation (3pm)<BR>Updated: 2020-02-08<BR><A HREF="#index">Index</A>
<A HREF="/cgi-bin/man/man2html">Return to Main Contents</A><HR>
<A NAME="lbAB">&nbsp;</A>
<H2>NAME</H2>
URI::data - URI that contains immediate data
<A NAME="lbAC">&nbsp;</A>
<H2>SYNOPSIS</H2>
<PRE>
use URI;
$u = URI-&gt;new(&quot;data:&quot;);
$u-&gt;media_type(&quot;image/gif&quot;);
$u-&gt;data(scalar(`cat camel.gif`));
print &quot;$u\n&quot;;
open(XV, &quot;|xv -&quot;) and print XV $u-&gt;data;
</PRE>
<A NAME="lbAD">&nbsp;</A>
<H2>DESCRIPTION</H2>
The <TT>&quot;URI::data&quot;</TT> class supports <TT>&quot;URI&quot;</TT> objects belonging to the <I>data</I>
<FONT SIZE="-1">URI</FONT> scheme. The <I>data</I> <FONT SIZE="-1">URI</FONT> scheme is specified in <FONT SIZE="-1">RFC 2397.</FONT> It
allows inclusion of small data items as ``immediate'' data, as if it had
been included externally. Examples:
<P>
<PRE>
data:,Perl%20is%20good
data:image/gif;base64,R0lGODdhIAAgAIAAAAAAAPj8+CwAAAAAI
AAgAAAClYyPqcu9AJyCjtIKc5w5xP14xgeO2tlY3nWcajmZZdeJcG
Kxrmimms1KMTa1Wg8UROx4MNUq1HrycMjHT9b6xKxaFLM6VRKzI+p
KS9XtXpcbdun6uWVxJXA8pNPkdkkxhxc21LZHFOgD2KMoQXa2KMWI
JtnE2KizVUkYJVZZ1nczBxXlFopZBtoJ2diXGdNUymmJdFMAADs=
</PRE>
<P>
<TT>&quot;URI&quot;</TT> objects belonging to the data scheme support the common methods
(described in <FONT SIZE="-1">URI</FONT>) and the following two scheme-specific methods:
<DL COMPACT>
<DT id="1">$uri-&gt;media_type( [$new_media_type] )<DD>
Can be used to get or set the media type specified in the
<FONT SIZE="-1">URI.</FONT> If no media type is specified, then the default
<TT>&quot;text/plain;charset=US-ASCII&quot;</TT> is returned.
<DT id="2">$uri-&gt;data( [$new_data] )<DD>
Can be used to get or set the data contained in the <FONT SIZE="-1">URI.</FONT>
The data is passed unescaped (in binary form). The decision about
whether to base64 encode the data in the <FONT SIZE="-1">URI</FONT> is taken automatically,
based on the encoding that produces the shorter <FONT SIZE="-1">URI</FONT> string.
</DL>
<A NAME="lbAE">&nbsp;</A>
<H2>SEE ALSO</H2>
<FONT SIZE="-1">URI</FONT>
<A NAME="lbAF">&nbsp;</A>
<H2>COPYRIGHT</H2>
Copyright 1995-1998 Gisle Aas.
<P>
This library is free software; you can redistribute it and/or
modify it under the same terms as Perl itself.
<P>
<HR>
<A NAME="index">&nbsp;</A><H2>Index</H2>
<DL>
<DT id="3"><A HREF="#lbAB">NAME</A><DD>
<DT id="4"><A HREF="#lbAC">SYNOPSIS</A><DD>
<DT id="5"><A HREF="#lbAD">DESCRIPTION</A><DD>
<DT id="6"><A HREF="#lbAE">SEE ALSO</A><DD>
<DT id="7"><A HREF="#lbAF">COPYRIGHT</A><DD>
</DL>
<HR>
This document was created by
<A HREF="/cgi-bin/man/man2html">man2html</A>,
using the manual pages.<BR>
Time: 00:05:59 GMT, March 31, 2021
</BODY>
</HTML>