{
    "mode": "perldoc",
    "parameter": "MIME::Field::ParamVal",
    "section": "",
    "url": "https://www.chedong.com/phpMan.php/perldoc/MIME%3A%3AField%3A%3AParamVal/json",
    "generated": "2026-06-14T00:40:12Z",
    "synopsis": "# Create an object for a content-type field:\n$field = new Mail::Field 'Content-type';\n# Set some attributes:\n$field->param(''        => 'text/html');\n$field->param('charset'  => 'us-ascii');\n$field->param('boundary' => '---ABC---');\n# Same:\n$field->set(''        => 'text/html',\n'charset'  => 'us-ascii',\n'boundary' => '---ABC---');\n# Get an attribute, or undefined if not present:\nprint \"no id!\"  if defined($field->param('id'));\n# Same, but use empty string for missing values:\nprint \"no id!\"  if ($field->paramstr('id') eq '');\n# Output as string:\nprint $field->stringify, \"\\n\";",
    "sections": {
        "NAME": {
            "content": "MIME::Field::ParamVal - subclass of Mail::Field, for structured MIME fields\n",
            "subsections": []
        },
        "SYNOPSIS": {
            "content": "# Create an object for a content-type field:\n$field = new Mail::Field 'Content-type';\n\n# Set some attributes:\n$field->param(''        => 'text/html');\n$field->param('charset'  => 'us-ascii');\n$field->param('boundary' => '---ABC---');\n\n# Same:\n$field->set(''        => 'text/html',\n'charset'  => 'us-ascii',\n'boundary' => '---ABC---');\n\n# Get an attribute, or undefined if not present:\nprint \"no id!\"  if defined($field->param('id'));\n\n# Same, but use empty string for missing values:\nprint \"no id!\"  if ($field->paramstr('id') eq '');\n\n# Output as string:\nprint $field->stringify, \"\\n\";\n",
            "subsections": []
        },
        "DESCRIPTION": {
            "content": "This is an abstract superclass of most MIME fields. It handles fields with a general syntax like\nthis:\n\nContent-Type: Message/Partial;\nnumber=2; total=3;\nid=\"oc=jpbe0M2Yt4s@thumper.bellcore.com\"\n\nComments are supported *between* items, like this:\n\nContent-Type: Message/Partial; (a comment)\nnumber=2  (another comment) ; (yet another comment) total=3;\nid=\"oc=jpbe0M2Yt4s@thumper.bellcore.com\"\n",
            "subsections": []
        },
        "PUBLIC INTERFACE": {
            "content": "set [\\%PARAMHASH | KEY=>VAL,...,KEY=>VAL]\n*Instance method.* Set this field. The paramhash should contain parameter names in *all\nlowercase*, with the special \"\" parameter name signifying the \"default\" (unnamed) parameter\nfor the field:\n\n# Set up to be...\n#\n#     Content-type: Message/Partial; number=2; total=3; id=\"ocj=pbe0M2\"\n#\n$conttype->set(''       => 'Message/Partial',\n'number'  => 2,\n'total'   => 3,\n'id'      => \"ocj=pbe0M2\");\n\nNote that a single argument is taken to be a *reference* to a paramhash, while multiple args\nare taken to be the elements of the paramhash themselves.\n\nSupplying undef for a hashref, or an empty set of values, effectively clears the object.\n\nThe self object is returned.\n\nparseparams STRING\n*Class/instance utility method.* Extract parameter info from a structured field, and return\nit as a hash reference. For example, here is a field with parameters:\n\nContent-Type: Message/Partial;\nnumber=2; total=3;\nid=\"oc=jpbe0M2Yt4s@thumper.bellcore.com\"\n\nHere is how you'd extract them:\n\n$params = $class->parseparams('content-type');\nif ($$params{''} eq 'message/partial') {\n$number = $$params{'number'};\n$total  = $$params{'total'};\n$id     = $$params{'id'};\n}\n\nLike field names, parameter names are coerced to lowercase. The special '' parameter means\nthe default parameter for the field.\n\nNOTE: This has been provided as a public method to support backwards compatibility, but you\nprobably shouldn't use it.\n\nparse STRING\n*Class/instance method.* Parse the string into the instance. Any previous information is\nwiped. The self object is returned.\n\nMay also be used as a constructor.\n\nparam PARAMNAME,[VALUE]\n*Instance method.* Return the given parameter, or undef if it isn't there. With argument,\nset the parameter to that VALUE. The PARAMNAME is case-insensitive. A \"\" refers to the\n\"default\" parameter.\n\nparamstr PARAMNAME,[VALUE]\n*Instance method.* Like param(): return the given parameter, or *empty* if it isn't there.\nWith argument, set the parameter to that VALUE. The PARAMNAME is case-insensitive. A \"\"\nrefers to the \"default\" parameter.\n\nstringify\n*Instance method.* Convert the field to a string, and return it.\n\ntag *Instance method, abstract.* Return the tag for this field.\n",
            "subsections": []
        },
        "SEE ALSO": {
            "content": "Mail::Field\n",
            "subsections": []
        }
    },
    "summary": "MIME::Field::ParamVal - subclass of Mail::Field, for structured MIME fields",
    "flags": [],
    "examples": [],
    "see_also": []
}