package Table::Denormalized::ColumnSet; use strict; =head1 NAME Table::Denormalized::ColumnSet - Encapsulate a group of columns =head1 SYNOPSIS use Table::Denormalized::ColumnSet; my $file_info = Table::Denormalized::ColumnSet->new( _name => 'File Information', uri => 'VARCHAR(1024)', size => 'INTEGER', modified => 'INTEGER', md5 => 'VARCHAR(64)', ); =head1 ABSTRACT This module (trivially) encapsulates a set of columns and gives that set a name. =cut use base 'Class::Accessor'; __PACKAGE__->mk_accessors(qw(name columns)); sub new { my ($class,%args) = @_; my $name = delete $args{_name}; my $self = $class->SUPER::new({name => $name, columns => []}); if (! $self->name) { my $caller = (caller(0))[0]; $caller =~ s!.*::Plugin::!!; $self->name($caller) }; $self->add_column(%args); $self; }; sub add_column { my $self = shift; while (@_) { if (ref $_[0]) { push @{ $self->columns }, shift; } else { my ($name,$type) = splice @_,0,2; push @{ $self->columns }, Table::Denormalized::Column->new({ name => $name, type => $type }); }; }; }; 1; =head1 AUTHOR Max Maischein, Ecorion@cpan.orgE =head1 SEE ALSO L, L