{
    "mode": "perldoc",
    "parameter": "URI::data",
    "section": "",
    "url": "https://www.chedong.com/phpMan.php/perldoc/URI%3A%3Adata/json",
    "generated": "2026-05-30T10:09:49Z",
    "synopsis": "use URI;\n$u = URI->new(\"data:\");\n$u->mediatype(\"image/gif\");\n$u->data(scalar(`cat camel.gif`));\nprint \"$u\\n\";\nopen(XV, \"|xv -\") and print XV $u->data;",
    "sections": {
        "NAME": {
            "content": "URI::data - URI that contains immediate data\n",
            "subsections": []
        },
        "SYNOPSIS": {
            "content": "use URI;\n\n$u = URI->new(\"data:\");\n$u->mediatype(\"image/gif\");\n$u->data(scalar(`cat camel.gif`));\nprint \"$u\\n\";\nopen(XV, \"|xv -\") and print XV $u->data;\n",
            "subsections": []
        },
        "DESCRIPTION": {
            "content": "The \"URI::data\" class supports \"URI\" objects belonging to the *data* URI\nscheme. The *data* URI scheme is specified in RFC 2397. It allows\ninclusion of small data items as \"immediate\" data, as if it had been\nincluded externally. Examples:\n\ndata:,Perl%20is%20good\n\ndata:image/gif;base64,R0lGODdhIAAgAIAAAAAAAPj8+CwAAAAAI\nAAgAAAClYyPqcu9AJyCjtIKc5w5xP14xgeO2tlY3nWcajmZZdeJcG\nKxrmimms1KMTa1Wg8UROx4MNUq1HrycMjHT9b6xKxaFLM6VRKzI+p\nKS9XtXpcbdun6uWVxJXA8pNPkdkkxhxc21LZHFOgD2KMoQXa2KMWI\nJtnE2KizVUkYJVZZ1nczBxXlFopZBtoJ2diXGdNUymmJdFMAADs=\n\n\"URI\" objects belonging to the data scheme support the common methods\n(described in URI) and the following two scheme-specific methods:\n\n$uri->mediatype( [$newmediatype] )\nCan be used to get or set the media type specified in the URI. If no\nmedia type is specified, then the default\n\"text/plain;charset=US-ASCII\" is returned.\n\n$uri->data( [$newdata] )\nCan be used to get or set the data contained in the URI. The data is\npassed unescaped (in binary form). The decision about whether to\nbase64 encode the data in the URI is taken automatically, based on\nthe encoding that produces the shorter URI string.\n",
            "subsections": []
        },
        "SEE ALSO": {
            "content": "URI\n",
            "subsections": []
        },
        "COPYRIGHT": {
            "content": "Copyright 1995-1998 Gisle Aas.\n\nThis library is free software; you can redistribute it and/or modify it\nunder the same terms as Perl itself.\n",
            "subsections": []
        }
    },
    "summary": "URI::data - URI that contains immediate data",
    "flags": [],
    "examples": [],
    "see_also": []
}