NAME

org::puremvc::perl5::patterns::observer::Notification

Implementation of the pureMVC Notification pattern.


DESCRIPTION

The Observer pattern as implemented within PureMVC exists to support event-driven communication between the application and the actors of the MVC triad.

Generally, Mediator or Proxy implementors broadcast Notifications to trigger commands or to communicate with other mediators.

Proxy and Command instances communicate with each other and mediators by broadcasting Notifications.

PureMVC Notifications follow a 'Publish/Subscribe' pattern. PureMVC classes need not be related to each other in a parent/child relationship in order to communicate with one another using Notifications.


INTERFACE

Methods

new

sub new( $notification_name, $body, $type );

Constructor.

You usually do not call Notification directly but use Facade sendNotification method to create and send a Notification:

  # Code usually found in a Notifier subclass
  
  # Create and send a notification called "SayHelloWorld" with no body nor type data passed 
  $self->sendNotification("SayHelloWorld");

Parameters

getName

sub getName();

Notification name getter.

Returns

String - The name of the Notification.

setBody

sub setBody( $body );

Notification body setter.

Parameters

getBody

getBody()

Notification body getter.

Returns

* - The body of the Notification, scalar or object.

setType

sub setType( $type );

Notification type setter.

Parameters

getType

sub getType();

Notification type getter.

Returns

* - The type of the Notification, scalar or object.


SEE ALSO

org::puremvc::perl5::core::Model

org::puremvc::perl5::core::View

org::puremvc::perl5::core::Controller

org::puremvc::perl5::patterns::facade::Facade

org::puremvc::perl5::patterns::proxy::Proxy

org::puremvc::perl5::patterns::mediator::Mediator

org::puremvc::perl5::patterns::command::SimpleCommand

org::puremvc::perl5::patterns::command::MacroCommand

org::puremvc::perl5::patterns::observer::Notifier

org::puremvc::perl5::patterns::observer::Observer