Gapp::Form::Context::Node - Context node object
$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' );
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.
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.
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.
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.
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.
Retrieves a value from the context. $path
is a string in the format of "node_name.attribute".
Sets a value in the context. $path
is a string in the format of "nodename.attribute".
Jeffrey Ray Hallock <jeffrey.hallock at gmail dot com>
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.