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
schema data creation wrapper.
table
set table name
pk
set primary key
columns
set columns
inflate_rule
set inflate rule
row_namespace
create Row class namespace
base_row_class
Specify the default base row class with Teng::Schema::Declare.
Default value is Teng::Row.
This option is useful when you adds features for My::DB::Row class.
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.