From: Matt S Trout Date: Tue, 21 Mar 2006 22:51:03 +0000 (+0000) Subject: Updates to Intro X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=24d34a8075ccbef3c1222f72ab13874f3f52d457;p=dbsrgits%2FDBIx-Class-Historic.git Updates to Intro --- diff --git a/lib/DBIx/Class/Manual/Intro.pod b/lib/DBIx/Class/Manual/Intro.pod index 0bd7a50..5483561 100644 --- a/lib/DBIx/Class/Manual/Intro.pod +++ b/lib/DBIx/Class/Manual/Intro.pod @@ -132,12 +132,11 @@ distribution. Like L, it inspects your database, and automatically creates classes for all the tables in your database. Here's a simple setup: - package MyApp::DB; - use DBIx::Class::Schema::Loader; + package My::Schema; + use base qw/DBIx::Class::Schema::Loader/; - my $loader = DBIx::Class::Loader->new( - dsn => 'dbi:SQLite:/home/me/myapp/my.db', - namespace => 'MyApp::DB' + __PACKAGE__->load_from_connection( + connect_info = [ 'dbi:SQLite:/home/me/myapp/my.db' ] ); 1; @@ -152,7 +151,7 @@ L already contains the connection info for the database, so to get started all you need to do is create an instance of your class: - my $schema = MyApp::DB->new(); + my $schema = My::Schema->new(); To connect to your manually created Schema, you also need to provide the connection details: @@ -184,7 +183,7 @@ The simplest way to get a record is by primary key: my $album = $schema->resultset('Album')->find(14); This will run a C