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";
In reply to Re: Tie and Tie::Handle
by kschwab
in thread Tie and Tie::Handle
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |