Nephia::Plugin::Teng - Simple ORMapper Plugin For Nephia
use Nephia plugins => [qw/Teng/]; path '/person/:id' => sub { my $id = path_param('id'); my $row = teng->lookup('person', { id => $id }); return res { 404 } unless $row; return { id => $id, name => $row->get_column('name'), age => $row->get_column('age'), }; };
Read row from person table in database in this code.
configuration file:
'DBI' => { connect_info => ['dbi:SQLite:dbname=data.db'], teng_plugins => [qw/Lookup Pager/] },
The "connect_info" is connect information for DBI.
Enumerate in "plugins" option if you want load Teng plugins.
"teng" DSL create the Teng Object.
In this example to create table before plackup.
in controller :
database_do "CREATE TABLE IF NOT EXISTS person (id INTEGER, name TEXT, age INTEGER);" path '/' => sub { ... };
Nephia
Teng
Copyright (C) macopy.
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
mackee <macopy123[attttt]gmai.com>
ichigotake
To install Nephia::Plugin::Teng, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Nephia::Plugin::Teng
CPAN shell
perl -MCPAN -e shell install Nephia::Plugin::Teng
For more information on module installation, please visit the detailed CPAN module installation guide.