in reply to Subclassing a class that uses an internal dispatch table
package Net::SMTP::Server::Client2::MySubClass; use strict; use vars qw/@ISA/; use Net::SMTP::Server::Client2; @isa = qw/Net::SMTP::Server::Client2/; my %private_commands = ( HELO => \&my_hello, [...] ); sub new { my ($class, $sock) = @_; my $self = $class->SUPER::new($sock); bless $self, __PACKAGE__; } [...] sub get_message { my ($self, $cmd, @args) = @_; return $self->SUPER::get_message($cmd, @args) unless exists $privat +e_commands{$cmd}; # from here on mimic the super class's method, but with # calls to your private, "overridden" methods. } sub my_hello { # perform some individual stuff. }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Subclassing a class that uses an internal dispatch table
by BrowserUk (Patriarch) on Oct 30, 2007 at 03:53 UTC | |
by TOD (Friar) on Oct 30, 2007 at 06:30 UTC |