File Coverage

blib/lib/FeyX/Active/Schema.pm
Criterion Covered Total %
statement 1 3 33.3
branch n/a
condition n/a
subroutine 1 1 100.0
pod n/a
total 2 4 50.0


line stmt bran cond sub pod time code
1             package FeyX::Active::Schema;
2 1     1   73183 use Moose;
  0            
  0            
3              
4             our $VERSION = '0.03';
5             our $AUTHORITY = 'cpan:STEVAN';
6              
7             use Fey::Table;
8             use Fey::DBIManager;
9              
10             extends 'Fey::Schema';
11              
12             has 'dbi_manager' => (
13             is => 'rw',
14             isa => 'Fey::DBIManager',
15             lazy => 1,
16             default => sub { Fey::DBIManager->new() },
17             );
18              
19             __PACKAGE__->meta->make_immutable;
20              
21             no Moose; 1;
22              
23             __END__
24              
25             =pod
26              
27             =head1 NAME
28              
29             FeyX::Active::Schema - An active Fey Schema
30              
31             =head1 SYNOPSIS
32              
33             use FeyX::Active::Schema;
34              
35             my $schema = FeyX::Active::Schema->new( name => 'MySchema' );
36              
37             $schema->dbi_manager->add_source( dsn => 'dbi:SQLite:dbname=foo' );
38              
39             # ...
40              
41             =head1 DESCRIPTION
42              
43             This is just a subclass of L<Fey::Schema> which also happens to
44             have a L<Fey::DBIManager> instance handy. Nothing much else going
45             on here actually.
46              
47             =head1 ATTRIBUTES
48              
49             =over 4
50              
51             =item B<dbi_manager>
52              
53             This will lazily create a L<Fey::DBIManager> instance to be
54             used by this schema.
55              
56             As of 0.02, this attribute is read/write so that it better
57             works with L<Fey::Loader>, like so:
58              
59             my $dbi_manager = Fey::DBIManager->new();
60              
61             $dbi_manager->add_source(...);
62              
63             my $loader = Fey::Loader->new(
64             dbh => $dbi_manager->default_source->dbh,
65             schema_class => 'FeyX::Active::Schema',
66             table_class => 'FeyX::Active::Table',
67             );
68              
69             my $schema = $loader->make_schema;
70              
71             $schema->dbi_manager($dbi_manager);
72              
73             =back
74              
75             =head1 BUGS
76              
77             All complex software has bugs lurking in it, and this module is no
78             exception. If you find a bug please either email me, or add the bug
79             to cpan-RT.
80              
81             =head1 AUTHOR
82              
83             Stevan Little E<lt>stevan.little@iinteractive.comE<gt>
84              
85             =head1 COPYRIGHT AND LICENSE
86              
87             Copyright 2009-2010 Infinity Interactive, Inc.
88              
89             L<http://www.iinteractive.com>
90              
91             This library is free software; you can redistribute it and/or modify
92             it under the same terms as Perl itself.
93              
94             =cut