Justin Hunter > Reaction-0.002005 > Reaction::Manual::Internals

Download:
Reaction-0.002005.tar.gz

Annotate this POD

CPAN RT

New  1
Open  1
Stalled  1
View/Report Bugs
Source  

NAME ^

Reaction::Manual::Internals

Hacking on Reaction

What is a component?

What component types are there?

How do I create a new component?

How does it work with a database?

What about Moose?

Moose

Type system

What Perl modules should I be familiar with, in order to hack on Reaction's internals?

Moose

A complete modern object system for Perl 5.

aliased

Use shorter package names, i.e., "X::Y::Z" as "Z".

Catalyst

The MVC application framework Reaction uses.

TT

Template Toolkit

Config::General

Generic config file module.

DBIx::Class

Object/Relational mapper.

DateTime
DateTime::Format::MySQL
Digest::MD5
Email::MIME
Email::MIME::Creator
Email::Send
Email::Valid
SQL::Translator
Test::Class
Test::Memory::Cycle
Time::ParseDate

Packages involved

Reaction::Class

Utility class, sets up to export a few methods that return parameters for use within Moose's has (as new parameters) in other packages. It also uses Moose itself.

The methods it injects are:

set_or_lazy_build($field_name)

The attribute is required, if not provided beforehand the build_${name} method will be called on the object when the attribute's getter is first called. If the method does not exist, or returns undef, an error will be thrown.

set_or_lazy_fail()

The attribute is required, if not provided beforehand the 'lazy' parameter of Moose will make it fail.

trigger_adopt()

Calls adopt_${type} after the attribute value is set to $type.

register_inc_entry()

Will mark the calling package as already included, using %INC.

Reaction::InterfaceModel::Action
Reaction::InterfaceModel::Action::DBIC::ResultSet::Create;
Reaction::InterfaceModel::Action::DBIC::ActionReflector;

A method "adaptor" that creates the needed objects to support CRUD DBIC actions. In the future the code could be moved to a class higher in the hierarchy and only contain the operations to adapt.

Sample run:

Reaction::InterfaceModel::Action::DBIC::ActionReflector->reflect_actions_for( Reaction::InterfaceModel::Action::DBIC::ActionReflector=HASH(0x93cb2f0) RTest::TestDB::Foo ComponentUI::Model::Action )

Generates and evaluates:

package ComponentUI::Model::Action::DeleteFoo; use Reaction::Class; extends 'Reaction::InterfaceModel::Action::DBIC::Result::Delete'; package ComponentUI::Model::Action::UpdateFoo; use Reaction::Class; extends 'Reaction::InterfaceModel::Action::DBIC::Result::Update'; has 'baz_list' => (isa => 'ArrayRef', is => 'rw', set_or_lazy_fail('baz_list'), default => sub { [] }, valid_values => sub { $_[0]->target_model ->result_source ->related_source('links_to_baz_list') ->related_source('baz') ->resultset; }); has 'last_name' => (isa => 'NonEmptySimpleStr', is => 'rw', set_or_lazy_fail('last_name')); has 'first_name' => (isa => 'NonEmptySimpleStr', is => 'rw', set_or_lazy_fail('first_name')); package ComponentUI::Model::Action::CreateFoo; use Reaction::Class; extends 'Reaction::InterfaceModel::Action::DBIC::ResultSet::Create'; has 'baz_list' => (isa => 'ArrayRef', is => 'rw', set_or_lazy_fail('baz_list'), default => sub { [] }, valid_values => sub { $_[0]->target_model ->result_source ->related_source('links_to_baz_list') ->related_source('baz') ->resultset; }); has 'last_name' => (isa => 'NonEmptySimpleStr', is => 'rw', set_or_lazy_fail('last_name')); has 'first_name' => (isa => 'NonEmptySimpleStr', is => 'rw', set_or_lazy_fail('first_name'));

Reaction::InterfaceModel::Action::DBIC::Result::Delete
Reaction::InterfaceModel::Action::DBIC::Result::Update
Reaction::InterfaceModel::Action::DBIC::User::ResetPassword
Reaction::InterfaceModel::Action::DBIC::User::Role::SetPassword
Reaction::InterfaceModel::Action::DBIC::User::ChangePassword
Reaction::InterfaceModel::Action::User::ResetPassword
Reaction::InterfaceModel::Action::User::ChangePassword
Reaction::InterfaceModel::Action::User::SetPassword
Reaction::Meta::InterfaceModel::Action::ParameterAttribute
Reaction::Meta::InterfaceModel::Action::Class
Reaction::Types::Email
Reaction::Types::Core
Reaction::Types::DateTime
Reaction::Types::File
Reaction::Types::DBIC
Reaction::UI::ViewPort::ListView
Reaction::UI::ViewPort::Field::Text
Reaction::UI::ViewPort::Field::ChooseMany
Reaction::UI::ViewPort::Field::String
Reaction::UI::ViewPort::Field::Number
Reaction::UI::ViewPort::Field::HiddenArray
Reaction::UI::ViewPort::Field::DateTime
Reaction::UI::ViewPort::Field::File
Reaction::UI::ViewPort::Field::ChooseOne
Reaction::UI::ViewPort::Field::Password
Reaction::UI::ViewPort::ActionForm
Reaction::UI::ViewPort::Field
Reaction::UI::FocusStack
Reaction::UI::RootController
Reaction::UI::Window
Reaction::UI::Renderer::XHTML
Reaction::UI::ViewPort
Reaction::UI::CRUDController
Reaction::UI::Controller

Remarks about POD

Don't use =over N. POD assumes that the indent level is 4 if you leave it out. Most POD renderers ignore your indent level anyway.

UNSORTED

Packages involved

t/lib/Rtest/TestDB*: TestDB DBIC declarations. t/lib/RTest/TestDB.pm: does DBIC populate for t/. t/lib/RTest/UI/ XXX

Reaction::Test::WithDB; Reaction::Test; Reaction::Test::Mock::Context; Reaction::Test::Mock::Request; Reaction::Test::Mock::Response;

AUTHORS ^

See Reaction::Class for authors.

LICENSE ^

See Reaction::Class for the license.

syntax highlighting: