NAME

Gapp::Form::Context::Node - Context node object

SYNOPSIS

$o = Foo::Character->new( fname => 'Mickey', lname => 'Mouse' );

$cx = Gapp::Form::Context->new;

$node = $cx->add( 'character', $o );

$node->lookup( 'fname' ); # returns 'Mickey'

$node->modify( 'fname', 'Minnie' );

DESCRIPTION

A context node contains a reference to a data structure and rules for accessing and modifying that data. The context is used to sync data between objects/data structures and forms.

OBJECT HIERARCHY

Gapp::Form::Context::Node

PROVIDED ATTRIBUTES

accessor
is rw
isa CodeRef|Undef
default Undef

The accessor is used to update and retrieve data from the data sctructure. If no accessor is set, reader and writer methods will be used.

content
is rw
isa Any|Undef
default Undef

The data structure to operate on. If set to a <CodeRef>, the CodeRef will be executed at lookup/modification time and the return value will be used as the data structure.

reader_prefix
is rw
isa Str|Undef
default Undef

When doing a lookup, the reader_prefix is appended to beginning of the attribute name to form the reader method. This method will then be called on the data structure to retrieve the value. If an accessor has been defined, that will be used instead.

writer_prefix
is rw
isa Str|Undef
default Undef

When doing a modify, the writer_prefix is appended to beginning of the attribute name to form the writer method. This method will then be called on the data structure to store the value. If an accessor has been defined, that will be used instead.

PROVIDED METHODS

lookup $attribute

Retrieves a value from the context. $path is a string in the format of "node_name.attribute".

modify $attribute, $path

Sets a value in the context. $path is a string in the format of "nodename.attribute".

AUTHORS

Jeffrey Ray Hallock <jeffrey.hallock at gmail dot com>

COPYRIGHT & LICENSE

Copyright (c) 2011-2012 Jeffrey Ray Hallock.

This program is free software; you can redistribute it and/or
modify it under the same terms as Perl itself.