develooper Front page | perl.perl5.porters | Postings from February 2012

Re: [PATCH] Add IO::Socket::IP 0.08 as dual-life module

Thread Previous
From:
Eric Brine
Date:
February 3, 2012 13:01
Subject:
Re: [PATCH] Add IO::Socket::IP 0.08 as dual-life module
Message ID:
CALJW-qFrj3O9QH08_zM9uevAc0J20YCmWNoHfp_g3tBL7QKXYw@mail.gmail.com
On Fri, Feb 3, 2012 at 9:31 AM, Paul LeoNerd Evans
<leonerd@leonerd.org.uk>wrote:

> 10-second thought:
>
>  package IO::Socket::INET;
>  use base qw( IO::Socket::IP );
>
>  sub new
>  {
>    shift->SUPER::new( Family => AF_INET, @_ );
>  }
>
>  1;
>
> Is probably the way to go about implementing that.
>

That implementation would break IO::Socket::INET->new($peer_addr), but
that's easy to fix.

sub new {
    my $class = shift;
    unshift(@_, 'PeerrAddr') if @_ == 1;
    return $class->SUPER::new( Family => AF_INET, @_ );
}

That implementation would break IO::Socket->new( Domain => AF_INET, ... ),
but that's easy to fix too. Just add

use IO::Socket::IP qw( -register );

- Eric

Thread Previous


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About