Teng::Schema::Declare - DSL For Declaring Teng Schema
package MyDB::Schema; use strict; use warnings; use Teng::Schema::Declare; table { name "your_table_name"; pk "primary_key"; columns qw( col1 col2 col3 ); inflate 'col1' => sub { my ($col_value) = @_; return MyDB::Class->new(name => $col_value); }; deflate 'col1' => sub { my ($col_value) = @_; return ref $col_value ? $col_value->name : $col_value; }; row_class 'MyDB::Row'; # optional };
use Teng::Schema::Declare; my $schema = schema { table { name "your_table_name"; columns qw( col1 col2 col3 ); }; } "MyDB::Schema";
schema data creation wrapper.
set table name
set primary key
set columns
set inflate rule
create Row class namespace
To install Teng, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Teng
CPAN shell
perl -MCPAN -e shell install Teng
For more information on module installation, please visit the detailed CPAN module installation guide.