package Xot::Table::Group; use strict; use Xot::Table; use base qw(Xot::Accessors); Xot::Table::Group->plain(qw(name xot parent)); Xot::Table::Group->multi('table' => 'Xot::Table'); sub new { my $class = shift; my ($xot, $name) = @_; # sneaky bahstahd my $self = $xot->table_group($name); $self ||= bless {}, $class; $self->init(@_); return $self; } sub init { my ($self, $xot, $name, $elt) = @_; $self->xot($xot); $self->name($name); $self->init_from_elt($elt) if (defined $elt); return $self; } sub init_from_elt { my ($self, $elt) = @_; $self->add_table($_->att('name'), $_) foreach $elt->children(); } 1;