in reply to Tie and Tie::Handle
You could just inherit from IO::Socket::INET and add your additional methods and whatnot. A small example of adding a peerhostport() method follows.
Good luck !package MyObject; use IO::Socket::INET; @ISA = ("IO::Socket::INET"); sub peerhostport { my $self=shift; my $peerport=$self->peerport; my $peerhost=$self->peerhost; return "$peerhost:$peerport"; } 1; package main; my $foo=MyObject->new(PeerAddr => 'www.perlmonks.org', PeerPort => '80', Proto => 'tcp'); my $string=$foo->peerhostport(); print "string is [$string]\n";
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Tie and Tie::Handle
by fembot (Initiate) on Jul 19, 2002 at 17:32 UTC |