|Think about Loose Coupling|
Implementing an event-driven object model in Perlby jkva (Chaplain)
|on Jun 23, 2006 at 18:56 UTC||Need Help??|
jkva has asked for the
wisdom of the Perl Monks concerning the following question:
Recently I bought the 1994 edition of the "Gang of Four" Design Patterns book. I've been reading it and it has taught me a lot of things already that I did not know before.
For a project I continually work on to exercise my Perl skills, I am thinking of implementing the following (my methodology might still be way off) :
I'd like to have objects that are in a certain state. When interacted with their state changes and they will call some kind of notification method on themselves. By calling this, let's say, $self->notify(), other objects will recieve this and act accordingly. This should form some kind of response-to-notification event model.
I am not sure how I would implement such in Perl, therefore I would like to lay this before the hive mind that is PerlMonks, and see what your thoughts are on this.
Thanks for reading,-- jkva