{
    "content": [
        {
            "type": "text",
            "text": "# Net::LDAP::Util (perldoc)\n\n## NAME\n\nNet::LDAP::Util - Utility functions\n\n## SYNOPSIS\n\nuse Net::LDAP::Util qw(ldaperrortext\nldaperrorname\nldaperrordesc\n);\n$mesg = $ldap->search( .... );\ndie \"Error \",ldaperrorname($mesg)  if $mesg->code;\n\n## DESCRIPTION\n\nNet::LDAP::Util is a collection of utility functions for use with the Net::LDAP modules.\n\n## Sections\n\n- **NAME**\n- **SYNOPSIS**\n- **DESCRIPTION**\n- **FUNCTIONS**\n- **AUTHOR**\n- **COPYRIGHT**\n\nUse structuredContent.sections for detailed options, examples, and full documentation.\n"
        }
    ],
    "structuredContent": {
        "command": "Net::LDAP::Util",
        "section": "",
        "mode": "perldoc",
        "summary": "Net::LDAP::Util - Utility functions",
        "synopsis": "use Net::LDAP::Util qw(ldaperrortext\nldaperrorname\nldaperrordesc\n);\n$mesg = $ldap->search( .... );\ndie \"Error \",ldaperrorname($mesg)  if $mesg->code;",
        "tldr_summary": null,
        "tldr_examples": [],
        "tldr_source": null,
        "flags": [],
        "examples": [],
        "see_also": [],
        "section_outline": [
            {
                "name": "NAME",
                "lines": 2,
                "subsections": []
            },
            {
                "name": "SYNOPSIS",
                "lines": 9,
                "subsections": []
            },
            {
                "name": "DESCRIPTION",
                "lines": 2,
                "subsections": []
            },
            {
                "name": "FUNCTIONS",
                "lines": 212,
                "subsections": []
            },
            {
                "name": "AUTHOR",
                "lines": 2,
                "subsections": []
            },
            {
                "name": "COPYRIGHT",
                "lines": 7,
                "subsections": []
            }
        ],
        "sections": {
            "NAME": {
                "content": "Net::LDAP::Util - Utility functions\n",
                "subsections": []
            },
            "SYNOPSIS": {
                "content": "use Net::LDAP::Util qw(ldaperrortext\nldaperrorname\nldaperrordesc\n);\n\n$mesg = $ldap->search( .... );\n\ndie \"Error \",ldaperrorname($mesg)  if $mesg->code;\n",
                "subsections": []
            },
            "DESCRIPTION": {
                "content": "Net::LDAP::Util is a collection of utility functions for use with the Net::LDAP modules.\n",
                "subsections": []
            },
            "FUNCTIONS": {
                "content": "ldaperrorname ( ERR )\nReturns the name corresponding with ERR. ERR can either be an LDAP error number, or a\n\"Net::LDAP::Message\" object containing an error code. If the error is not known the a string\nin the form \"\"LDAP error code %d(0x%02X)\"\" is returned.\n\nldaperrortext ( ERR )\nReturns the text from the POD description for the given error. ERR can either be an LDAP\nerror code, or a \"Net::LDAP::Message\" object containing an LDAP error code. If the error\ncode given is unknown then \"undef\" is returned.\n\nldaperrordesc ( ERR )\nReturns a short text description of the error. ERR can either be an LDAP error code or a\n\"Net::LDAP::Message\" object containing an LDAP error code.\n\ncanonicaldn ( DN [ , OPTIONS ] )\nReturns the given DN in a canonical form. Returns undef if DN is not a valid Distinguished\nName. (Note: The empty string \"\" is a valid DN.) DN can either be a string or reference to\nan array of hashes as returned by ldapexplodedn, which is useful when constructing a DN.\n\nIt performs the following operations on the given DN:\n\n*   Removes the leading 'OID.' characters if the type is an OID instead of a name.\n\n*   Escapes all RFC 4514 special characters (\",\", \"+\", \"\"\", \"\\\", \"<\", \">\", \";\", \"#\", \"=\", \"\n\"), slashes (\"/\"), and any other character where the ASCII code is < 32 as \\hexpair.\n\n*   Converts all leading and trailing spaces in values to be \\20.\n\n*   If an RDN contains multiple parts, the parts are re-ordered so that the attribute type\nnames are in alphabetical order.\n\nOPTIONS is a list of name/value pairs, valid options are:\n\ncasefold\nControls case folding of attribute type names. Attribute values are not affected by this\noption. The default is to uppercase. Valid values are:\n\nlower\nLowercase attribute type names.\n\nupper\nUppercase attribute type names. This is the default.\n\nnone\nDo not change attribute type names.\n\nmbcescape\nIf TRUE, characters that are encoded as a multi-octet UTF-8 sequence will be escaped as\n\\(hexpair){2,*}.\n\nreverse\nIf TRUE, the RDN sequence is reversed.\n\nseparator\nSeparator to use between RDNs. Defaults to comma (',').\n\nldapexplodedn ( DN [ , OPTIONS ] )\nExplodes the given DN into an array of hashes and returns a reference to this array. Returns\nundef if DN is not a valid Distinguished Name.\n\nA Distinguished Name is a sequence of Relative Distinguished Names (RDNs), which themselves\nare sets of Attributes. For each RDN a hash is constructed with the attribute type names as\nkeys and the attribute values as corresponding values. These hashes are then stored in an\narray in the order in which they appear in the DN.\n\nFor example, the DN 'OU=Sales+CN=J. Smith,DC=example,DC=net' is exploded to: [ { 'OU' =>\n'Sales', 'CN' => 'J. Smith' }, { 'DC' => 'example' }, { 'DC' => 'net' } ]\n\n(RFC4514 string) DNs might also contain values, which are the bytes of the BER encoding of\nthe X.500 AttributeValue rather than some LDAP string syntax. These values are hex-encoded\nand prefixed with a #. To distinguish such BER values, ldapexplodedn uses references to\nthe actual values, e.g. '1.3.6.1.4.1.1466.0=#04024869,DC=example,DC=com' is exploded to: [ {\n'1.3.6.1.4.1.1466.0' => \"\\004\\002Hi\" }, { 'DC' => 'example' }, { 'DC' => 'com' } ];\n\nIt also performs the following operations on the given DN:\n\n*   Unescape \"\\\" followed by \",\", \"+\", \"\"\", \"\\\", \"<\", \">\", \";\", \"#\", \"=\", \" \", or a hexpair\nand strings beginning with \"#\".\n\n*   Removes the leading 'OID.' characters if the type is an OID instead of a name.\n\nOPTIONS is a list of name/value pairs, valid options are:\n\ncasefold\nControls case folding of attribute types names. Attribute values are not affected by\nthis option. The default is to uppercase. Valid values are:\n\nlower\nLowercase attribute types names.\n\nupper\nUppercase attribute type names. This is the default.\n\nnone\nDo not change attribute type names.\n\nreverse\nIf TRUE, the RDN sequence is reversed.\n\nescapefiltervalue ( VALUES )\nEscapes the given VALUES according to RFC 4515 so that they can be safely used in LDAP\nfilters.\n\nAny control characters with an ASCII code < 32 as well as the characters with special\nmeaning in LDAP filters \"*\", \"(\", \")\", and \"\\\" the backslash are converted into the\nrepresentation of a backslash followed by two hex digits representing the hexadecimal value\nof the character.\n\nReturns the converted list in list mode and the first element in scalar mode.\n\nunescapefiltervalue ( VALUES )\nUndoes the conversion done by escapefiltervalue().\n\nConverts any sequences of a backslash followed by two hex digits into the corresponding\ncharacter.\n\nReturns the converted list in list mode and the first element in scalar mode.\n\nescapednvalue ( VALUES )\nEscapes the given VALUES according to RFC 4514 so that they can be safely used in LDAP DNs.\n\nThe characters \",\", \"+\", \"\"\", \"\\\", \"<\", \">\", \";\", \"#\", \"=\" with a special meaning in section\n2.4 of RFC 4514 are preceded by a backslash. Control characters with an ASCII code < 32 are\nrepresented as \\hexpair. Finally all leading and trailing spaces are converted to sequences\nof \\20.\n\nReturns the converted list in list mode and the first element in scalar mode.\n\nunescapednvalue ( VALUES )\nUndoes the conversion done by escapednvalue().\n\nAny escape sequence starting with a backslash - hexpair or special character - will be\ntransformed back to the corresponding character.\n\nReturns the converted list in list mode and the first element in scalar mode.\n\nldapurlparse ( LDAP-URL [, OPTIONS ] )\nParse an LDAP-URL conforming to RFC 4516 into a hash containing its elements.\n\nFor easy cooperation with LDAP queries, the hash keys for the elements used in LDAP search\noperations are named after the parameters to \"search\" in Net::LDAP.\n\nIn extension to RFC 4516, the socket path for URLs with the scheme \"ldapi\" will be stored in\nthe hash key named \"path\".\n\nIf any element is omitted, the result depends on the setting of the option \"defaults\".\n\nOPTIONS is a list of key/value pairs with the following keys recognized:\n\ndefaults\nA Boolean option that determines whether default values according to RFC 4516 shall be\nreturned for missing URL elements.\n\nIf set to TRUE, default values are returned, with \"ldapurlparse\" using the following\ndefaults in extension to RFC 4516.\n\n*   The default port for \"ldaps\" URLs is 636.\n\n*   The default path for \"ldapi\" URLs is the contents of the environment variable\n\"LDAPISOCK\". If that is not defined or empty, then \"/var/run/ldapi\" is used.\n\nThis is consistent with the behaviour of \"new\" in Net::LDAP.\n\n*   The default \"host\" name for \"ldap\" and \"ldaps\" URLs is \"localhost\".\n\nWhen set to FALSE, no default values are used.\n\nThis leaves all keys in the resulting hash undefined where the corresponding URL element\nis empty.\n\nTo distinguish between an empty base DN and an undefined base DN, \"ldapurlparse\" uses\nthe slash between the host:port resp. path part of the URL and the base DN part of the\nURL. With the slash present, the hash key \"base\" is set to the empty string, without it,\nit is left undefined.\n\nLeaving away the \"defaults\" option entirely is equivalent to setting it to TRUE.\n\nReturns the hash in list mode, or the reference to the hash in scalar mode.\n\ngeneralizedTimetotime ( GENERALIZEDTIME )\nConvert the generalizedTime string GENERALIZEDTIME, which is expected to match the template\n\"YYYYmmddHH[MM[SS]][(./,)d...](Z|(+/-)HH[MM])\" to a floating point number compatible with\nUNIX time (i.e. the integral part of the number is a UNIX time).\n\nReturns an extended UNIX time or \"undef\" on error.\n\nTimes in years smaller than 1000 will lead to \"undef\" being returned. This restriction is a\ndirect effect of the year value interpretation rules in Time::Local.\n\nNote: this function depends on Perl's implementation of time and Time::Local. See \"Limits of\ntimet\" in Time::Local, \"Negative Epoch Values\" in Time::Local, and \"gmtime\" in perlport for\nrestrictions in older versions of Perl.\n\ntimetogeneralizedTime ( TIME [, OPTIONS ] )\nConvert the UNIX time TIME to a generalizedTime string.\n\nIn extension to UNIX times, TIME may be a floating point number, the decimal part will be\nused for the resulting generalizedTime.\n\nOPTIONS is a list of key/value pairs. The following keys are recognized:\n\nAD  Take care of an ActiveDirectory peculiarity to always require decimals.\n\nReturns the generalizedTime string, or \"undef\" on error.\n\nTimes before BC or after year 9999 result in \"undef\" as they cannot be represented in the\ngeneralizedTime format.\n\nNote: this function depends on Perl's implementation of gmtime. See \"Limits of timet\" in\nTime::Local, \"Negative Epoch Values\" in Time::Local, and \"gmtime\" in perlport for\nrestrictions in older versions of Perl.\n",
                "subsections": []
            },
            "AUTHOR": {
                "content": "Graham Barr <gbarr@pobox.com>\n",
                "subsections": []
            },
            "COPYRIGHT": {
                "content": "Copyright (c) 1999-2004 Graham Barr. All rights reserved. This program is free software; you can\nredistribute it and/or modify it under the same terms as Perl itself.\n\nldapexplodedn and canonicaldn also\n\n(c) 2002 Norbert Klasen, norbert.klasen@daasi.de, All Rights Reserved.\n",
                "subsections": []
            }
        }
    }
}