add proof-of-concept perl script to render the tree to SVG
This will be useful to generate examples for the documentation.
This commit is contained in:
21
render-tree/Con.pm
Normal file
21
render-tree/Con.pm
Normal file
@ -0,0 +1,21 @@
|
||||
# vim:ts=4:sw=4:expandtab
|
||||
package Con;
|
||||
|
||||
use Moose;
|
||||
use MooseX::AttributeHelpers;
|
||||
use v5.10;
|
||||
|
||||
has 'name' => (is => 'ro', isa => 'Str');
|
||||
has 'width' => (is => 'rw', isa => 'Int', default => 100);
|
||||
has '_nodes' => (is => 'ro', metaclass => 'Collection::Array', isa => 'ArrayRef[Con]',
|
||||
default => sub { [] },
|
||||
provides => {
|
||||
'push' => 'add_node',
|
||||
elements => 'nodes',
|
||||
}
|
||||
);
|
||||
has 'parent' => (is => 'rw', isa => 'Con', predicate => 'has_parent');
|
||||
|
||||
__PACKAGE__->meta->make_immutable;
|
||||
|
||||
1
|
Reference in New Issue
Block a user