{
    "content": [
        {
            "type": "text",
            "text": "# Net::LDAP::Entry (perldoc)\n\n## NAME\n\nNet::LDAP::Entry - An LDAP entry object\n\n## SYNOPSIS\n\nuse Net::LDAP;\n$ldap = Net::LDAP->new ( $host );\n$mesg = $ldap->search ( @searchargs );\nmy $max = $mesg->count;\nfor ( $i = 0 ; $i < $max ; $i++ ) {\nmy $entry = $mesg->entry ( $i );\nforeach my $attr ( $entry->attributes ) {\nprint join( \"\\n \", $attr, $entry->getvalue( $attr ) ), \"\\n\";\n}\n}\n# or\nuse Net::LDAP::Entry;\n$entry = Net::LDAP::Entry->new;\n$entry->dn($dn);\n$entry->add (\nattr1 => 'value1',\nattr2 => [ qw(value1 value2) ]\n);\n$entry->delete ( 'unwanted' );\n$entry->replace (\nattr1 => 'newvalue',\nattr2 => [ qw(new values) ]\n);\n$entry->update ( $ldap ); # update directory server\n$entry2 = $entry->clone; # copies entry\n# new alternate syntax\n$entry = Net::LDAP::Entry->new ( $dn,\nattr1 => 'value1',\nattr2 => [ qw(value1 value2) ]\n)->add(\nattr3   => 'value'\n)->update( $ldap );\n\n## DESCRIPTION\n\nThe Net::LDAP::Entry object represents a single entry in the directory. It is a container for\nattribute-value pairs.\n\n## Sections\n\n- **NAME**\n- **SYNOPSIS**\n- **DESCRIPTION**\n- **CONSTRUCTORS**\n- **METHODS**\n- **SEE ALSO**\n- **AUTHOR**\n- **COPYRIGHT**\n\nUse structuredContent.sections for detailed options, examples, and full documentation.\n"
        }
    ],
    "structuredContent": {
        "command": "Net::LDAP::Entry",
        "section": "",
        "mode": "perldoc",
        "summary": "Net::LDAP::Entry - An LDAP entry object",
        "synopsis": "use Net::LDAP;\n$ldap = Net::LDAP->new ( $host );\n$mesg = $ldap->search ( @searchargs );\nmy $max = $mesg->count;\nfor ( $i = 0 ; $i < $max ; $i++ ) {\nmy $entry = $mesg->entry ( $i );\nforeach my $attr ( $entry->attributes ) {\nprint join( \"\\n \", $attr, $entry->getvalue( $attr ) ), \"\\n\";\n}\n}\n# or\nuse Net::LDAP::Entry;\n$entry = Net::LDAP::Entry->new;\n$entry->dn($dn);\n$entry->add (\nattr1 => 'value1',\nattr2 => [ qw(value1 value2) ]\n);\n$entry->delete ( 'unwanted' );\n$entry->replace (\nattr1 => 'newvalue',\nattr2 => [ qw(new values) ]\n);\n$entry->update ( $ldap ); # update directory server\n$entry2 = $entry->clone; # copies entry\n# new alternate syntax\n$entry = Net::LDAP::Entry->new ( $dn,\nattr1 => 'value1',\nattr2 => [ qw(value1 value2) ]\n)->add(\nattr3   => 'value'\n)->update( $ldap );",
        "tldr_summary": null,
        "tldr_examples": [],
        "tldr_source": null,
        "flags": [],
        "examples": [],
        "see_also": [],
        "section_outline": [
            {
                "name": "NAME",
                "lines": 2,
                "subsections": []
            },
            {
                "name": "SYNOPSIS",
                "lines": 46,
                "subsections": []
            },
            {
                "name": "DESCRIPTION",
                "lines": 10,
                "subsections": []
            },
            {
                "name": "CONSTRUCTORS",
                "lines": 17,
                "subsections": []
            },
            {
                "name": "METHODS",
                "lines": 207,
                "subsections": []
            },
            {
                "name": "SEE ALSO",
                "lines": 2,
                "subsections": []
            },
            {
                "name": "AUTHOR",
                "lines": 5,
                "subsections": []
            },
            {
                "name": "COPYRIGHT",
                "lines": 3,
                "subsections": []
            }
        ],
        "sections": {
            "NAME": {
                "content": "Net::LDAP::Entry - An LDAP entry object\n",
                "subsections": []
            },
            "SYNOPSIS": {
                "content": "use Net::LDAP;\n\n$ldap = Net::LDAP->new ( $host );\n$mesg = $ldap->search ( @searchargs );\n\nmy $max = $mesg->count;\nfor ( $i = 0 ; $i < $max ; $i++ ) {\nmy $entry = $mesg->entry ( $i );\nforeach my $attr ( $entry->attributes ) {\nprint join( \"\\n \", $attr, $entry->getvalue( $attr ) ), \"\\n\";\n}\n}\n\n# or\n\nuse Net::LDAP::Entry;\n\n$entry = Net::LDAP::Entry->new;\n\n$entry->dn($dn);\n\n$entry->add (\nattr1 => 'value1',\nattr2 => [ qw(value1 value2) ]\n);\n\n$entry->delete ( 'unwanted' );\n\n$entry->replace (\nattr1 => 'newvalue',\nattr2 => [ qw(new values) ]\n);\n\n$entry->update ( $ldap ); # update directory server\n\n$entry2 = $entry->clone; # copies entry\n\n# new alternate syntax\n\n$entry = Net::LDAP::Entry->new ( $dn,\nattr1 => 'value1',\nattr2 => [ qw(value1 value2) ]\n)->add(\nattr3   => 'value'\n)->update( $ldap );\n",
                "subsections": []
            },
            "DESCRIPTION": {
                "content": "The Net::LDAP::Entry object represents a single entry in the directory. It is a container for\nattribute-value pairs.\n\nA Net::LDAP::Entry object can be used in two situations. The first and probably most common use\nis in the result of a search to the directory server.\n\nThe other is where a new object is created locally and then a single command is sent to the\ndirectory server to add, modify or replace an entry. Entries for this purpose can also be\ncreated by reading an LDIF file with the Net::LDAP::LDIF module.\n",
                "subsections": []
            },
            "CONSTRUCTORS": {
                "content": "new ( )\nCreate a new entry object with the changetype set to 'add'. Optionally, you can provide a DN\nand a list of arguments passed to the add method.\n\nNet::LDAP::Entry->new()\n\n# or\nNet::LDAP::Entry->new( $dn )\n\n# or\nNet::LDAP::Entry->new( $dn ,\nobjectClass => [qw( top posixAccount )] , uid => 'admin'\n)\n\nclone ( )\nReturns a copy of the Net::LDAP::Entry object.\n",
                "subsections": []
            },
            "METHODS": {
                "content": "add ( ATTR => VALUE, ... )\nAdd more attributes or values to the entry and returns the entry itself. Each \"VALUE\" should\nbe a string if only a single value is wanted in the attribute, or a reference to an array of\nstrings if multiple values are wanted. The values given will be added to the values which\nalready exist for the given attributes.\n\n$entry->add ( 'sn' => 'Barr' );\n\n$entry->add ( 'street' => [ '1 some road','nowhere' ] );\n\nNOTE: these changes are local to the client and will not appear on the directory server\nuntil the \"update\" method is called. As \"add\" returns the entry, you can write something\nlike.\n\n$entry->add ( 'sn' => 'Barr' )->update( $ldap );\n\nattributes ( OPTIONS )\nReturn a list of attributes in this entry\n\nnooptions => 1\nReturn a list of the attribute names excluding any options. For example for the entry\n\nname: Graham Barr\nname;en-us: Bob\njpegPhoto;binary: binary data\n\nthen\n\n@values = $entry->attributes;\nprint \"default: @values\\n\";\n\n@values = $entry->attributes ( nooptions => 1 );\nprint \"nooptions: @values\\n\";\n\nwill output\n\ndefault: name name;en-us jpegPhoto;binary\nnooptions: name jpegPhoto\n\nchangetype ( )\nReturns the type of operation that would be performed when the update method is called.\n\nchangetype ( TYPE )\nSet the type of operation that will be performed when the update method is called to \"TYPE\".\nReturns the entry itself.\n\nPossible values for \"TYPE\" are\n\nadd The update method will call the add method on the client object, which will result in\nthe entry being added to the directory server.\n\ndelete\nThe update method will call the delete method on the client object, which will result in\nthe entry being removed from the directory server.\n\n$entry->delete->update( $ldap )\n\nmodify\nThe update method will call the modify method on the client object, which will result in\nany changes that have been made locally being made to the entry on the directory server.\n\nmoddn/modrdn\nThe update method will call the moddn method on the client object, which will result in\nany DN changes that have been made locally being made to the entry on the directory\nserver. These DN changes are specified by setting the entry attributes newrdn,\ndeleteoldrdn, and (optionally) newsuperior.\n\ndelete ( )\nDelete the entry from the server on the next call to \"update\".\n\ndelete ( ATTR => [ VALUE, ... ], ... )\nDelete the values of given attributes from the entry. Values are references to arrays;\npassing a reference to an empty array is the same as passing \"undef\", and will result in the\nentire attribute being deleted. For example:\n\n$entry->delete ( 'mail' => [ 'foo.bar@example.com' ] );\n$entry->delete ( 'description' => [ ], 'streetAddress' => [ ] );\n\nNOTE: these changes are local to the client and will not appear on the directory server\nuntil the \"update\" method is called.\n\ndn ( )\nGet the DN of the entry.\n\ndn ( DN )\nSet the DN for the entry, and return the previous value.\n\nNOTE: these changes are local to the client and will not appear on the directory server\nuntil the \"update\" method is called.\n\nldif ( OPTION => VALUE, ... )\nReturns the entry as an LDIF string. Possible options are all options \"new\" in\nNet::LDAP::LDIF allows, with two being treated special:\n\nchange => VALUE\nIf given a true value then the LDIF will be generated as a change record. If false, then\nthe LDIF generated will represent the entry content. If unspecified then it will default\nto true if the entry has changes and false if no changes have been applied to the entry.\n\nversion => VALUE\nNo matter what value is passed, it will be ignored, and treated as if 0 were given.\n\ndump ( [ FILEHANDLE ] )\nDump the entry to the given filehandle.\n\nThis method is intended for debugging purposes and does not treat binary attributes\nspecially. It also does not deal properly with entries resulting from LDIF change records.\n\nSee Net::LDAP::LDIF on how to generate LDIF output.\n\nIf \"FILEHANDLE\" is omitted \"STDOUT\" is used by default.\n\nexists ( ATTR )\nReturns \"TRUE\" if the entry has an attribute called \"ATTR\".\n\ngetvalue ( ATTR, OPTIONS )\nGet the values for the attribute \"ATTR\". In a list context returns all values for the given\nattribute, or the empty list if the attribute does not exist. In a scalar context returns\nthe first value for the attribute or undef if the attribute does not exist.\n\nalloptions => 1\nThe result will be a hash reference. The keys of the hash will be the options and the\nhash value will be the values for those attributes. For example if an entry had:\n\nname: Graham Barr\nname;en-us: Bob\n\nThen a get for attribute \"name\" with alloptions set to a true value\n\n$ref = $entry->getvalue ( 'name', alloptions => 1 );\n\nwill return a hash reference that would be like\n\n{\n''       => [ 'Graham Barr' ],\n';en-us' => [ 'Bob' ]\n}\n\nIf alloptions is not set or is set to false only the attribute values for the exactly\nmatching name are returned.\n\nnooptions => 1\nInstead of only returning the values of the exactly matching attribute name, get the\nattribute values of all attributes with the base name given. I.e. in the example above,\ncalling\n\n@array = $entry->getvalue ( 'name', nooptions => 1 );\n\nwill yield\n\n( 'Graham Barr', 'Bob' )\n\nThe name of this option has neen chosen for consistency with the equally named option in\nthe attributes method.\n\nasref => 1\nThe result will be a reference to an array containing all the values for the attribute,\nor \"undef\" if the attribute does not exist.\n\n$scalar = $entry->getvalue ( 'name' );\n\n$scalar will be the first value for the \"name\" attribute, or \"undef\" if the entry does\nnot contain a \"name\" attribute.\n\n$ref = $entry->getvalue ( 'name', asref => 1 );\n\n$ref will be a reference to an array, which will have all the values for the \"name\"\nattribute. If the entry does not have an attribute called \"name\" then $ref will be\n\"undef\".\n\nNOTE: In the interest of performance the array references returned by \"getvalue\" may be\nreferences to structures held inside the entry object. These values and their contents\nshould NOT be modified directly.\n\nreplace ( ATTR => VALUE, ... )\nSimilar to \"add\", except that the values given will replace any values that already exist\nfor the given attributes.\n\nNOTE: these changes are local to the client and will not appear on the directory server\nuntil the \"update\" method is called.\n\nupdate ( CLIENT [, OPTIONS ] )\nUpdate the directory server with any changes that have been made locally to the attributes\nof this entry. This means any calls that have been made to add, replace or delete since the\nlast call to changetype or update was made.\n\nThis method can also be used to modify the DN of the entry on the server, by specifying\nmoddn or modrdn as the changetype, and setting the entry attributes newrdn, deleteoldrdn,\nand (optionally) newsuperior.\n\n\"CLIENT\" is a \"Net::LDAP\" object where the update will be sent to.\n\n\"OPTIONS\" may be options to the \"Net::LDAP\" actions on CLIENT corresponding to the entry's\nchangetype.\n\nThe result will be an object of type Net::LDAP::Message as returned by the add, modify or\ndelete method called on CLIENT.\n\nAlternatively \"CLIENT\" can also be a \"Net::LDAP::LDIF\" object, that must be an LDIF file\nopened for writing.\n\nIn this case, the entry, together with any \"OPTIONS\" is passed as arguments to the\n\"writeentry\" method of the \"CLIENT\" object.\n\nHere too, the result is an object class \"Net::LDAP::Message\". On error, the error code is\n\"LDAPOTHER\" with the LDIF error message in the error text.\n",
                "subsections": []
            },
            "SEE ALSO": {
                "content": "Net::LDAP, Net::LDAP::LDIF\n",
                "subsections": []
            },
            "AUTHOR": {
                "content": "Graham Barr <gbarr@pobox.com>.\n\nPlease report any bugs, or post any suggestions, to the perl-ldap mailing list\n<perl-ldap@perl.org>.\n",
                "subsections": []
            },
            "COPYRIGHT": {
                "content": "Copyright (c) 1997-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",
                "subsections": []
            }
        }
    }
}