Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris
 
PerlMonks  

Re: Subclassing a class that uses an internal dispatch table

by broquaint (Abbot)
on Oct 30, 2007 at 13:16 UTC ( #648010=note: print w/ replies, xml ) Need Help??


in reply to Subclassing a class that uses an internal dispatch table

I'd probably make use of PadWalker like so:

use PadWalker 'peek_sub'; my $sub = \&Net::SMTP::Server::Client2::get_message; my $cmds = peek_sub($sub)->{'%_cmds'}; $cmds->{$_} = __PACKAGE__->can($_) || $cmds->{$_} for keys %$cmds;
Of course that won't support multiple subclasses, but it will work for the simple case of a single subclass. It's "a hack for a hack" if you will.
HTH

_________
broquaint


Comment on Re: Subclassing a class that uses an internal dispatch table
Download Code
Re^2: Subclassing a class that uses an internal dispatch table
by BrowserUk (Pope) on Oct 30, 2007 at 19:18 UTC

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://648010]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others surveying the Monastery: (4)
As of 2015-07-06 02:19 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (69 votes), past polls