org::puremvc::perl5::patterns::observer::Notification
Implementation of the pureMVC Notification
pattern.
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 Notification
s to trigger commands or to communicate with other mediators.
Proxy and Command instances communicate with each other and mediators by broadcasting Notification
s.
PureMVC Notification
s 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 Notification
s.
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
$notification_name - String
Name of the constructed Notification
instance.
$body - *
Body or (business data) of the Notification
. Can be any object or scalar. - Optional
$type - *
Type of the Notification
. This data can be useful to distinguish several types of the same Notification
. Usually is a string but could be any other object or scalar. - Optional
Notification
name getter.
Returns
String
- The name of the Notification
.
Notification
body setter.
Parameters
$body - *
Body or (business data) of the Notification
. Can be any object or scalar. - Optional
Notification
body getter.
Returns
*
- The body of the Notification
, scalar or object.
Notification
type setter.
Parameters
$type - *
Type of the Notification
. This data can be useful to distinguish several types of the same Notification
. Usually is a string but could be any other object or scalar. - Optional
Notification
type getter.
Returns
*
- The type of the Notification
, scalar or object.
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