NAME DBIx::Inline - DBIx::Class without the class. DESCRIPTION This module is yet another interface to DBI. I like how DBIx::Class works, separating the results from the resultsets, the resultsets from the results and the schema from everything else. It's tidy, easy to follow and works a treat. I also like how you can "reuse" queries in resultsets and results without typing them out again and again. However, when I wanted to work on a small project I found DBIx::Class a little slow and didn't want to keep setting up the classes for it to work. DBIx::Inline attempts follow the way DBIx::Class does things, but more "inline". You still get the reusable queries, Results and ResultSets, but without all the classes to setup. You do lose a lot of functionality that you get with DBIx::Class, but that's not what DBIx::Inline is really about. I wanted it to be faster and not hold your hand with everything, yet still be easy enough to use. It's still possible to have accessors and Result/ResulSet methods, but they are created on-the-fly with method. Also, you can automatically create all accessors for a result using load_accessors. DBIx::Inline is great for small projects that do not require a lot of customisation, but for anything else I'd highly recommend DBIx::Class. SYNOPSIS package main; use base 'DBIx::Inline'; my $schema = main->connect( dbi => 'SQLite:test.db' ); my $rs = $schema->resultset('my_user_table'); # create a resultset method $rs->method(not_active => sub { return shift->search([], { account_status => 'disabled' }, { order => ['id'], rows => 5 }); }); # chain the custom resultset method with a core one (count) print "Rows returned: " . $rs->not_active->count . "\n"; # make the records in the resultset active # will return a resultset with the updated data my $new_rs = $rs->update({account_status => 'active'}); connect Creates the Schema instance using the hash specified. Currently only dbi is mandatory, which tells DBI which engine to use (SQLite, Pg, etc). If you're using SQLite there is no need to set user or pass. my $dbh = DBIx::Inline->connect( dbi => 'SQLite:/var/db/test.db', ); my $dbh = DBIx::Inline->connect( dbi => 'Pg:host=myhost;dbname=dbname', user => 'username', pass => 'password', ); model This method needs a lot of work, but it functions at the moment. And I like it. Instead of calling the connect method in every file, you can share the model by putting it in inline.yml (which it looks for by default), or setting ->config. # inline.yml --- Foo: connect: 'SQLite:foo.db' AnotherSchema: connect: 'Pg:host=localhost;dbname=foo' user: 'myuser' pass: 'pass' # test.pl package main; my $rs = main->model('AnotherSchema')->resultset('the_table'); sqlite Initially load a SQLite database (file). Instead of going through models or dbi string we can just call "sqlite('file')". package main; use base 'DBIx::Inline'; my $schema = main->sqlite('/path/to/db.db')->resultset('users'); config Sets the location of the configuration (file with the models. The Schema models.. not girls). This allows you to have the file anywhere on your system and you can rename it to anything. # /var/schema/myschemas.yml Foo: connect: 'SQLite:/var/db/mydb.db' # /scripts/db.pl package main; use base 'DBIx::Inline'; main->config ('/var/schema/myschemas.yml'); my $schema = main->model('Foo'); AUTHOR Brad Haywood LICENSE You may distribute this code under the same terms as Perl itself.