Mailing List Archive

nice new Socket.pm
I forget whether this was JACKS or SPIDB who did this, but it's
certainly an improvement.

Coupla questions:

1) How come pack_sockaddr_in and unpack_sockaddr_in rather
than what I had been using:

$paddr = sockaddr_in(AF_INET, $port, $iaddr);
($fam, $port, $iaddr) = sockaddr_in($paddr);

It's a very simple mod to Socket.xs for wantarray()ness.

2) Is there ever a case of using sockaddr_in (note the _in)
structure when you aren't using AF_INET? If not, this
would be simpler:

$paddr = sockaddr_in($port, $iaddr);
($port, $iaddr) = sockaddr_in($paddr);

Hm.. seems to me I've actually always used them this way:

$paddr = sockaddr_in($iaddr, $port);
($iaddr, $port) = sockaddr_in($paddr);

3) Is there any reason not to also do sockaddr_un()?

--tom
Re: nice new Socket.pm [ In reply to ]
> 1) How come pack_sockaddr_in and unpack_sockaddr_in rather
> than what I had been using:
>
> = sockaddr_in(AF_INET, , );
> (, , ) = sockaddr_in();
>
> It's a very simple mod to Socket.xs for wantarray()ness.

cuz I prefer to have explicit pack/unpack funcs. I don't see any reason
why we can't have the sockaddr_in as well, though (or from your
perspective, the pack_sockaddr_in/unpack_sockaddr_in as well).

> 2) Is there ever a case of using sockaddr_in (note the _in)
> structure when you aren't using AF_INET? If not, this
> would be simpler:
>
> = sockaddr_in(, );
> (, ) = sockaddr_in();
>
> Hm.. seems to me I've actually always used them this way:
>
> = sockaddr_in(, );
> (, ) = sockaddr_in();

I think you're right.

> 3) Is there any reason not to also do sockaddr_un()?

No - go ahead :-). On SunOS 4 its in 'sys/un.h'. Maybe Spider's
already done it his Net:: modules? I haven't checked them lately.

-- Jack Shirazi, JackS@slc.com