NAME

Linux::Event::Address - lazy socket-address value

SYNOPSIS

my $peer = $stream->peer;
if ($peer && $peer->family eq 'inet') {
    say $peer->host . ':' . $peer->port;
}

DESCRIPTION

Represents a packed IPv4, IPv6, or Unix socket address. Stream, Listener, and Datagram use it for peer and local addresses. The packed sockaddr is retained without conversion; textual parsing occurs only when an accessor is used. Accessors that do not apply to the address family return undef.

METHODS

sockaddr

Return the original packed peer address.

family / family_number

Return inet, inet6, unix, or unknown, and the numeric address-family constant.

host / port

Return Internet host and port details when applicable.

path

Return the Unix peer path when supplied by the kernel.

scope_id / flowinfo

Return IPv6 ancillary address fields.

PERFORMANCE

Listener and Datagram create Address values directly from packed sockaddrs returned by accept4 and recvmsg. Applications that do not inspect an address avoid address-to-text conversion entirely.