Mailing List Archive

Re: Socket errors
>Hi All,
> I've just finished installing Perl5.001l and libwww-perl-5b6.
>I had been using the Perl4 versions of both. And now I am getting the
>following error using both the GET and request programs:

>Can't locate auto/Socket/sockaddr_in.al in @INC

>I hope this is a Perl5 NEWBIE question <grin>
>like I need to use the Socket.pm in Perl5 and not the one in LWP <????>

>Can any one point me in the right direction?

Hm... no, you should be able to use the standard one, but we've been
playing with it. (I also think I disagree with some of LWP::Socket.pm,
but that's another matter.)

I recently tried to release a "unified" Socket.pm that unified Gisle's,
Jack's, and my interfaces in v1.2 of the Socket module. I was very close:
Here's v1.2 sockaddr_in, trying to be many things to many people

sub sockaddr_in {
if (@_ == 6 && wantarray) { # perl5.001m compat; use this && die
my($af, $port, @quad) = @_;
pack_sockaddr_in($port, inet_aton(join('.', @quad)));
} elsif (wantarray) {
unpack_sockaddr_in($_[0])
} else {
pack_sockaddr_in(@_[0,1])
}
}

The bug is that the first wantarray should be negated:

sub sockaddr_in {
if (@_ == 6 && !wantarray) { # perl5.001m compat; use this && die
my($af, $port, @quad) = @_;
pack_sockaddr_in($port, inet_aton(join('.', @quad)));
} elsif (wantarray) {
unpack_sockaddr_in($_[0])
} else {
pack_sockaddr_in(@_[0,1])
}
}

The LWP stuff now works -- at least, I tested HEAD and got proper results,
which I didn't get with the 1.2 :-(, so I've put a new Socket-1.3 with this
fix in ftp://perl.com/pub/perl/ext/Socket-1.3.tar.gz for your fetching.

If you really really want to, you should now be able to say

use Socket 1.3;

and be happy.

--tom

I'm not sure I'm fond of the notion of our supporting that 6-arg
version forever. Hence the comment. Maybe someday it's start
eliciting -w warnings, then mandatory warnings, then boom! :-)
Re: Socket errors [ In reply to ]
> (I also think I disagree with some of LWP::Socket.pm,
> but that's another matter.)

Can you elaborate?

--
Gisle Aas <aas@oslonett.no>
Oslonett AS http://www.oslonett.no/home/aas/
Re: Socket errors [ In reply to ]
> From: Tom Christiansen <tchrist@mox.perl.com>
>
> >Hi All,
> > I've just finished installing Perl5.001l and libwww-perl-5b6.
> >I had been using the Perl4 versions of both. And now I am getting the
> >following error using both the GET and request programs:
>
> >Can't locate auto/Socket/sockaddr_in.al in @INC
>
> >I hope this is a Perl5 NEWBIE question <grin>
> >like I need to use the Socket.pm in Perl5 and not the one in LWP <????>
>
> >Can any one point me in the right direction?
>
> Hm... no, you should be able to use the standard one, but we've been
> playing with it. (I also think I disagree with some of LWP::Socket.pm,
> but that's another matter.)

The immediate problem can be resolved by upgrading to Perl5.001m.

Tim.
Re: Socket errors [ In reply to ]
>The immediate problem can be resolved by upgrading to Perl5.001m.

And broken in Perl5.001n (without my Socket-1.3), right?

--tom