kenshin has asked for the wisdom of the Perl Monks concerning the following question:

Hi. I'm working on simple client-server application for fetching some performance data from monitored servers. Client application connects to serveral servers and fetch some data. Client uses Cmd class for communication. I changed a `protocol' a little bit so now I have two classes Cmd and CmdOld for communicating with servers application. I'm seeking for some design pattern which exactly fits this scenario. Currently I'm getting Cmd instance from CmdFactory depending on server application version (stored in DB, returns Cmd instance if NULL). I just wanted to make my code less ugly. Thank you.

Replies are listed 'Best First'.
Re: different protocol design pattern
by moritz (Cardinal) on May 07, 2010 at 19:24 UTC
    Are you sure you're talking about Perl? I don't see any Cmd module on CPAN, and Perl code typically doesn't have so many factories :-)

    If yes, please tell us more about these Cmd and CmdFactory modules, otherwise we can't help you.

    Perl 6 - links to (nearly) everything that is Perl 6.

      There is Net::Cmd but surely the OP doesn't mean that module.