DBIx::Custom::Model - Model (experimental)
use DBIx::Custom::Table;
my $table = DBIx::Custom::Model->new(table => 'books');
(experimental) columns
my $columns = $model->columns; $model = $model->columns(['id', 'number']);
dbi
my $dbi = $model->dbi; $model = $model->dbi($dbi);
DBIx::Custom object.
table
my $table = $model->table; $model = $model->table('book');
Table name.
primary_key
my $primary_key = $model->primary_key; $model = $model->primary_key(['id', 'number']);
Foreign key. This is used by update_at(), delete_at(), select_at().
update_at()
delete_at()
select_at()
DBIx::Custom inherits all methods from Object::Simple, and you can use all methods of the object set to dbi. and implements the following new ones.
delete
$table->delete(...);
Same as delete() of DBIx::Custom except that you don't have to specify table option.
delete()
delete_all
$table->delete_all(...);
Same as delete_all() of DBIx::Custom except that you don't have to specify table option.
delete_all()
method
$table->method( count => sub { my $self = shift; return $self->select(column => 'count(*)', @_) ->fetch_first->[0]; } );
Add method to a DBIx::Custom::Table object.
insert
$table->insert(...);
Same as insert() of DBIx::Custom except that you don't have to specify table option.
insert()
new
my $table = DBIx::Custom::Table->new;
Create a DBIx::Custom::Table object.
select
$table->select(...);
Same as select() of DBIx::Custom except that you don't have to specify table option.
select()
update
$table->update(...);
Same as update() of DBIx::Custom except that you don't have to specify table option.
update()
update_all
$table->update_all(param => \%param);
Same as update_all() of DBIx::Custom except that you don't have to specify table name.
update_all()
To install DBIx::Custom, copy and paste the appropriate command in to your terminal.
cpanm
cpanm DBIx::Custom
CPAN shell
perl -MCPAN -e shell install DBIx::Custom
For more information on module installation, please visit the detailed CPAN module installation guide.