Take the 2-minute tour ×

Is it possible to extend a base class to include additional commands? For example, lets say I have a custom IMAP server that supports a command called "WUNTEE"... I would like to use the private Net::IMAP::send_command method to send "WUNTEE", but since its private, how would that be possible? Is that even possible? Thanks.

share|improve this question

1 Answer 1

You can either subclass it as required, which is perfectly acceptable, or patch the base class with the new methods you want. From a design standpoint, a subclass is a cleaner approach, but you may find that some of the other related classes use Net::IMAP directly and getting them to use your specific version is tricky or impractical.

It's actually pretty straight-forward to patch out any methods you don't like with your own implementation by simply re-defining them at any point in the execution of your program.

share|improve this answer

Your Answer


