X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FDBIx%2FClass%2FManual%2FIntro.pod;h=cad46935109c6a5461545480efc8902daf7505f1;hb=de60a93dfda2e3384c2f6a00d55b352a4b4188c0;hp=0bd7a509d2313bd1ccb55231a026d153d4403dad;hpb=5cc9fa326a20e3b70842d4ceb74328afd46d164e;p=dbsrgits%2FDBIx-Class-Historic.git diff --git a/lib/DBIx/Class/Manual/Intro.pod b/lib/DBIx/Class/Manual/Intro.pod index 0bd7a50..cad4693 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: @@ -164,7 +163,7 @@ a second database you want to access: my $other_schema = My::Schema->connect( $dsn, $user, $password, $attrs ); -Note that L does not cache connnections for you. If you +Note that L does not cache connections for you. If you use multiple connections, you need to do this manually. To execute some sql statements on every connect you can pass them to your schema after the connect: @@ -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