in reply to NET::LDAP and objectGUID

No responses, but I found a solution. I still don't know why I can't turn around and use the same retrieved data for the filter criteria 100% of the time, but using information from the following:

GUIDs and SIDs

Net::LDAP GUID...

I can now search by the objectGUID 100% of the time in my tests.

sub GuidToString { my $stringGUID = unpack("H*", shift); $stringGUID =~ s/^(\w\w)(\w\w)(\w\w)(\w\w)(\w\w)(\w\w)(\w\w)(\w\w) +(\w\w)(\w\w)(\w\w)(\w\w)(\w\w)(\w\w)(\w\w)(\w\w)/\\$1\\$2\\$3\\$4\\$5 +\\$6\\$7\\$8\\$9\\$10\\$11\\$12\\$13\\$14\\$15\\$16/; return $stringGUID; }

Replies are listed 'Best First'.
Re^2: NET::LDAP and objectGUID
by haukex (Archbishop) on Jan 25, 2017 at 15:25 UTC

    Hi ksublondie,

    I don't know anything about LDAP GUIDs, but I just wanted to suggest a way to shorten that code. Note that unlike the regex, this works for input strings of any length.

    sub GuidToString { return join '', map {"\\$_"} unpack "(H2)*", shift; }

    Regards,
    -- Hauke D