yes, you're right. both $cmd and @args will be received through the socket. hmm... what about this one:
#!/usr/bin/perl -w { package Net::SMTP::Server::Client2::Subclass; use strict; use vars qw/@ISA/; use Net::SMTP::Server::Client2; @ISA = qw/Net::SMTP::Server::Client2/; my %_pcmds = ( HELO => \do { print STDERR "hello\n" } ); our $eval_command = sub { my ($self, $cmd, @args) = @_; my $hash = (__PACKAGE__ =~ /Subclass$/) ? '$_pcmds' : '$ +_cmds'; $cmd = "&{$hash"."{$cmd}}(\$self, \\\@args)"; eval $cmd or return(defined($self->{MSG})); }; &Net::SMTP::Server::Client2::eval_command = \$eval_command; sub new { my ($class, $sock) = @_; my $self = $class->SUPER::new($sock); bless $self, __PACKAGE__; } sub get_message { my $self = shift; my ($cmd, @args); # [...} # do everything the super class does, up to this point: if (exists $_pcmds{$cmd}) { $eval_command->($self, $cmd, @args); } else { $self->SUPER::eval_command($cmd, @args); } } 1; }
i've never done that before, but at least the compiler doesn't complain.
--------------------------------
masses are the opiate for religion.

In reply to Re^3: Subclassing a class that uses an internal dispatch table by TOD
in thread Subclassing a class that uses an internal dispatch table by BrowserUk

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.