(1) Fix the logic which maps local port (lldpLocPortId/lldpLocPortDesc) to interface index.
Currently it matches only lldpLocPortDesc against ifDescr and ifAlias. However in many switches (e.g. Netgear, Dell) the PortDesc is a user-supplied comment or empty string if no comment has been set. Because SNMP::Info doesn't test for the empty-string case, and because many interfaces will have empty string for ifAlias, it returns an arbitrary interface.
The new logic looks at lldpLocPortId (if non-blank) and then lldpLocPortDesc (ditto). It matches them in turn again ifName, ifDescr and then ifAlias.
Typically ifName is the short port name like "Gi1/0/1" (Cisco) or "1/0/1" (Netgear), and for both those vendors it's the same as the value in lldpLocPortId, at least with the firmware versions I tested.
(2) Fix the logic of the returned remote port name (lldp_port)
Currently it returns lldpRemPortDesc unless the PortIdType is "interfaceName" in which case it returns lldpRemPortId.
However there are switches which set PortIdType to "local" and return the correct port name in lldpRemPortId, but lldpRemPortDesc is either a user-supplied comment or empty string.
The new logic returns lldpRemPortId if PortIdType is either "local" or "interfaceName" but is otherwise unchanged.