org::puremvc::perl5::patterns::command::SimpleCommand
inherits:
Base pureMVC Command concept implementation.
package com::me::myapp::commands::ACommand;
use strict; use warnings;
use org::puremvc::perl5::patterns::command::SimpleCommand; our @ISA = qw( org::puremvc::perl5::patterns::command::SimpleCommand );
use com::me::myapp::Facade; #********************** #********************** sub execute { my ( $self, $notification ) = @_;
my $data_key = $notification->getBody();
my $facade = com::me::myapp::Facade->getInstance();
my $proxy = $facade->retrieveProxy( "AProxy" );
my $data = $proxy->some_method( $data_key );
my $mediator = $facade->retrieveMediator( "AMediator" );
$mediator->do_something( $data );
}
#********************** #********************** 1;
In PureMVC, Command implementors assume the business logic of your application.
Your Command subclasses should override the execute method to implement this business logic.
Fulfill the use-case initiated by the given notification.
In the Command pattern, an application use-case typically begins with some user action, which results in a notification being broadcast, which is handled by business logic in the execute method of a Command.
Inside this method, Proxy, Mediator registration, retrieval, removal is achieved to insure business logic linked to the notification.
Parameters
$notification - org::puremvc::perl5::patterns::observer::Notification
The notification to handle.
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::observer::Notification
org::puremvc::perl5::patterns::proxy::Proxy
org::puremvc::perl5::patterns::mediator::Mediator
org::puremvc::perl5::patterns::command::MacroCommand