Data::Region

Data::Region Perl module can define hierarchical areas with behaviors.
Download

Data::Region Ranking & Summary

Advertisement

  • Rating:
  • License:
  • Perl Artistic License
  • Price:
  • FREE
  • Publisher Name:
  • Greg Fast
  • Publisher web site:
  • http://search.cpan.org/~gregfast/Data-Region-1.0/Region.pm

Data::Region Tags


Data::Region Description

Data::Region Perl module can define hierarchical areas with behaviors. Data::Region Perl module can define hierarchical areas with behaviors.SYNOPSIS use Data::Region; $r = Data::Region->new( 8.5, 11, { data => PageObj->new() } ); $r->data( PageObj->new() ); foreach my $c ( $r->subdivide(2.5,3) ) { $a = $c->area(0.25,0.25, 2.25,2.75); $a2 = $c->area(0.25,0.25, -0.25,-0.25); # as offset from lower right ($t,$m,$b) = $a->split_vertical(2,5,1); # sequential heights ($t,$m,$b) = $a->split_vertical_abs(0,2,7); # absolute offsets ($l,$r) = $a->split_horizontal(2); # $l gets width of 2, $r gets the rest my($x1,$y1,$x2,$y2) = $a->coords(); my $data = $a->data(); # data inherits from parent, if not set $a->action( sub { $data->setfont("Times-Bold", 10); $data->text($x1,$y1, "Some Text"); $data->line( $_->coords() ); # the non-closure way } ); } $r->render(); # heirarchically perform all the actions # Get some info about a region: ($w,$h) = ( $a->width(), $a->height() ); ($x1,$y1, $x2,$y2) = $a->coords(); ($x1,$y1) = $a->top_left(); ($x2,$y1) = $a->top_right(); ($x1,$y2) = $a->bottom_left(); ($x2,$y2) = $a->bottom_right();Data::Region allows you to easily define a set of nested (2-dimensional) areas, defined by related coordinates, and to associate actions with them. The actions can then be performed hierarchically from any root of the tree.Data::Region was written to provide an easy way to do simple page layout, but has, perhaps, more general uses. Requirements: · Perl


Data::Region Related Software