I'm not sure I'm understanding you correctly, but it somehow sounds like you want to subclass IO::Socket or IO::Socket::INET, and override selected methods with your own implementations (?) Calls to other methods would then be forwarded to the superclass...
#!/usr/bin/perl -w use strict; package IO::Socket::WhatEver; use IO::Socket::INET; use base "IO::Socket::INET"; sub connect { print "doing my own stuff in connect()...\n"; my $sock = shift; return $sock->SUPER::connect(@_); } package main; my $mysock = IO::Socket::WhatEver->new( PeerAddr => 'perlmonks.org', PeerPort => 'http(80)', Proto => 'tcp', ); # ...
$ ./883113.pl doing my own stuff in connect()...
Instead of calling $sock->SUPER::connect(...) in the overridden method (which eventually calls the connect() builtin), you can of course also call your own low-level connect() implementation... provided it does something which is compatible with what the regular builtin would do.
In reply to Re: Typeglob substitution in objects based typeglob
by Anonyrnous Monk
in thread Typeglob substitution in objects based typeglob
by OlegG
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |