org::puremvc::perl5::core::Model
Singleton responsible for implementing the MVC Model
pattern.
In PureMVC, the Model
class assumes these responsibilities:
Maintain a cache of Proxy instances.
Provide methods for registering, retrieving, and removing proxies.
Notifiying proxies when they are registered or removed.
Your application must register Proxy instances with the Model
.
Typically, you use a command to create and register Proxy instances once the Facade
has initialized the Core actors.
Returns the singleton instance of the Model
.
Returns
org::puremvc::perl5::core::Model
- The singleton instance of the Model
.
Initialize the singleton instance of the Model
.
This method is automatically called during singleton instantiation.
This is where you will achieve your Model
subclass specific initializations if your application actually overrides pureMVC Model
class.
Register a Proxy instance with the Model
. During registration proxy's getProxyName
method is called by Model
singleton to map $proxy
instance with its name.
Any registered proxy is afterwards retrieved, removed or checked by its name.
Parameters
$proxy - org::puremvc::perl5::patterns::proxy::Proxy
A Proxy instance to register with the Model
.
sub retrieveProxy( $proxy_name );
Retrieve from the Model
a proxy registered with name $proxy_name
.
Parameters
$proxy_name - String
Name of the proxy to retrieve from the Model
.
Returns
org::puremvc::perl5::patterns::proxy::Proxy
- The Proxy instance retrieved from the Model
.
sub removeProxy( $proxy_name );
Remove from the Model
a proxy registered with name $proxy_name
.
Parameters
$proxy_name - String
Name of the proxy to remove from the Model
.
Returns
org::puremvc::perl5::patterns::proxy::Proxy
- The Proxy instance removed from the Model
.
Check whether a proxy is registered with name $proxy_name
or not.
Parameters
$proxy_name - String
Name of the proxy to check.
Returns
scalar
- 1 if a Proxy instance is registered with the Model
with name $proxy_name
, "" otherwise.
Array reference on registered Proxies with the Model
. You should not have to access it and must not update it in normal usage.
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::SimpleCommand
org::puremvc::perl5::patterns::command::MacroCommand