From: Matt S Trout Date: Thu, 4 Aug 2005 16:41:32 +0000 (+0000) Subject: Quick synopsis to Schema system in POD X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=c2da098af3f4de986bd20632ce8b1cc4982a2893;p=dbsrgits%2FDBIx-Class-Historic.git Quick synopsis to Schema system in POD --- diff --git a/lib/DBIx/Class/Schema.pm b/lib/DBIx/Class/Schema.pm index fd992e1..c402eff 100644 --- a/lib/DBIx/Class/Schema.pm +++ b/lib/DBIx/Class/Schema.pm @@ -8,6 +8,47 @@ use DBIx::Class; __PACKAGE__->mk_classdata('_class_registrations' => {}); +=head1 NAME + +DBIx::Class::Schema - composable schemas + +=head1 SYNOPSIS + + in My/Schema.pm + + package My::Schema; + + use base qw/DBIx::Class::Schema/; + + __PACKAGE__->load_classes(qw/Foo Bar Baz/); + + in My/Schema/Foo.pm + + package My::Schema::Foo; + + use base qw/DBIx::Class::Core/; + + __PACKAGE__->table('foo'); + ... + + in My/DB.pm + + use My::Schema; + + My::Schema->compose_connection('My::DB', $dsn, $user, $pass, $attrs); + + then in app code + + my @obj = My::DB::Foo->retrieve_all; # My::DB::Foo isa My::Schema::Foo My::DB + +=head1 DESCRIPTION + +=head1 METHODS + +=over 4 + +=cut + sub register_class { my ($class, $name, $to_register) = @_; my %reg = %{$class->_class_registrations}; @@ -45,3 +86,16 @@ sub compose_connection { } 1; + +=back + +=head1 AUTHORS + +Matt S. Trout + +=head1 LICENSE + +You may distribute this code under the same terms as Perl itself. + +=cut +