```{index} single: unpack_sockaddr_un; Socket function ``` ```{index} single: Socket::unpack_sockaddr_un; Perl function ``` # unpack_sockaddr_un Extract the filesystem path from a packed `sockaddr_un`. ## Synopsis ```perl my ($path) = unpack_sockaddr_un($sockaddr); ``` ## What you get back The `sun_path` field as a string, trimmed at the first NUL byte, or `undef` if the input is too short to be a `sockaddr_un`. ## Examples ```perl my ($path) = unpack_sockaddr_un(getsockname($sock)); print "listening on $path\n"; ``` ## Edge cases - Abstract Linux-namespace sockets have a leading NUL; the result is truncated at that first NUL, so callers that need the full abstract name must unpack the raw bytes themselves. - Input shorter than 3 bytes yields `undef`. ## Differences from upstream Fully compatible with upstream Socket. ## See also - `pack_sockaddr_un` — reverse direction.