Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??

Friends,

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

Update :
So far I am thinking that all objects classes are subclasses of a class which has a notify() method, which calls some kind of hub class, which knows about all objects and notifies them, this way there would be some kind "distributed awareness". Just doodling with my mind here, it might be very bad :)


In reply to Implementing an event-driven object model in Perl by jkva

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



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others chilling in the Monastery: (9)
As of 2024-04-23 10:42 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found