NAME

Class::MVC - model-view-controller paradigma

SYNOPSIS

	use Class::Maker 'class';

	use Class::MVC;
	
	class 'Widget',
	{
		isa => [qw( Class::MVC )]
	};

	class 'Widget::ViewModel',
	{			
		isa => [qw( Device::Output::Channel )],
		
		public =>
		{
			string => [qw( info )],
		},
	};

	class 'Widget::Model',
	{
		isa => [qw( Class::MVC::Model Shell::Widget::ViewModel)],
	};

	class 'Widget::View',
	{
		isa => [qw( Class::MVC::CompositeView )],
		
		public =>
		{
			ref => [qw( device )],
		},
	};

	class 'Widget::Controller',
	{
		isa => [qw( Class::MVC::Controller )],		
		
		public => 
		{
			ref => [qw( sensor )],
		},
		
		default =>
		{
			sensor => Device::Input->new(),
		},
	};	
  

DESCRIPTION

The Model-View-Controller (MVC) is a general paradigma mostly used for GUI-development. It is very well known and tons of publications are available through your favorite search engine (Or jump to "REFERENCES"). It is also an introductional example from the famous "Design Patterns" book.

                           +------------+
                           |   Model    |
                           +------------+
                          /\ .          /\
                          / .            \
                         / .              \
                        / .                \
                       / \/                 \
                 +------------+ <------ +------------+
Graphical  <==== |    View    |         | Controller |  <==== User Input
 Output          +------------+ ......> +------------+

Class::MVC::Model

This class is derived from Class::Observable (Class::Observable). Class::MVC::View's observe it to make appropriate changes to the presentation (aka View) if an update of the "Class::MVC::Model" happens.

[Note] Some publications prefer to separate a Data Model and a View Model. My personal preference tend to have a simple ViewModel class and let a DataModel class derive from Class::MVC::Model and our ViewModel class.

Class::MVC::View

model

Reference to a Class::MVC::Model object.

controller

Reference to a Class::MVC::Controller object.

Class::MVC::Model-notify_observers( 'update' )> will call a _on_update method of the observing View's.

[Note] Class::MVC::View is derived from Class::Listener to dispatch the observer notify to the _on_update method.

Class::MVC::CompositeView

This is the base class for nested views. A CompsiteView is a derived View. Its update() method takes the job to inform the super_view of sub_view changes changes.

See "REFERENCES".

super_view

Points to the view that contains it and another subviews.

sub_views (unimplemented)

An array pointing to all subviews.

Class::MVC::Controller

model

Reference to a Class::MVC::Model.

view

Reference to a Class::MVC::View.

update_model()

Sends a Class::Listener update ( $this, @_ ) signal to the model.

change_view()

Sends a Class::Listener change ( $this, @_ ) signal to the view.

Calls Class::MVC::View methods to do controller specific view changes (for example beep() or flicker() when wrong input is done).

SIGNALS

Signals are transported via the Class::Listener::signal method ("SEE ALSO").

EXPORT

None by default.

AUTHOR

Murat Uenalan, <muenalan@cpan.org>

SEE ALSO

Class::Maker, Class::Listener and Class::Observable.

REFERENCES

[1]

http://ootips.org/mvc-pattern.html

[2]

http://www.enode.com/x/markup/tutorial/mvc.html

[3]

http://st-www.cs.uiuc.edu/users/smarch/st-docs/mvc.html

2 POD Errors

The following errors were encountered while parsing the POD:

Around line 315:

=back without =over

Around line 335:

=over without closing =back