Data-Region
view release on metacpan or search on metacpan
C<split_horizontal()> returns a list of new Data::Region objects.
=item $r->split_horizontal_abs( @offsets )
To C<split_horizontal()> as C<split_vertical_abs()> is to
C<split_vertical()>.
C<split_horizontal_abs()> returns a list of new Data::Region objects.
=back
=head2 Finding out about Data::Regions
The following methods allow you to query Data::Region objects for data about
the areas they represent.
=over 4
=item $r->coords()
Returns the coordinates of the corners of this Data::Region. The list
returned is (top-left-X, top-left-Y, bottom-right-X, bottom-right-Y).
=item $r->width()
Returns the width of this Data::Region (the difference between the Y
coordinates of the top-left and bottom-right corners).
=item $r->height()
Returns the height of this Data::Region (the difference between the X
coordinates of the top-left and bottom-right corners).
=item $r->top_left()
Returns a list of the X and Y coordinates for the top left corner of
this Data::Region.
=item $r->top_right
Returns a list of the X and Y coordinates for the top right corner of
this Data::Region.
=item $r->bottom_right
Returns a list of the X and Y coordinates for the bottom right corner of
this Data::Region.
=item $r->bottom_left
Returns a list of the X and Y coordinates for the bottom left corner of
this Data::Region.
=back
=head2 Associating behavior with Data::Regions
The following methods allow you to associate data and callbacks to a
tree of Data::Regions, and to request a Data::Region to perform its tree of
callbacks.
=over 4
=item $r->data( [$reference] )
Returns, and optionally sets, the C<data> reference associated with
this Data::Region. Any child regions created under this Data::Region inherit the
reference of their parent (at the time they are created).
C<data()> returns the a reference for the current 'data' field.
=item $r->action( $coderef )
Associates an action with this Data::Region, to be performed when this
Data::Region's, or an ancestor Data::Region of this Data::Region's, C<render()> method
is called.
The argument is a code reference, which will be called with the Data::Region
object as its parameter. So for example, you may do
$r->action( sub {
my $self = shift;
# ...$self is the same obj as $r when this is run
} );
A Data::Region may have any number of actions. Actions will be executed in
the order that they were assocaited with C<action()>.
=item $r->render()
Performs the actions associated with this Data::Region, and all of its
child Data::Regions.
Actions are performed for this region first, then for all of its
children recursively. For each Data::Region, actions are performed in the
order that they were added to that Data::Region. The order in which child
Data::Regions are recursed into is undefined, but is probably the same as
the order they were created in (eg, that's the way it currently works,
but is subject to change).
=back
=head1 INTERNAL METHODS
The following should be used only within the module itself.
=over 4
=item $r->_init( @args )
Performs object initialization. Called by C<new()>, the purpose of
this method is to separate initialization logic from object-creation
gruntwork. If you subclass this module, it should be sufficient to
override C<_init()> rather than C<new()>.
The list of arguments passed to C<new()> are provided.
C<_init()> returns nothing.
( run in 1.777 second using v1.01-cache-2.11-cpan-483215c6ad5 )