| File: | lib/DBIx/SchemaChecksum/App.pm |
| Coverage: | 100.0% |
| line | stmt | bran | cond | sub | time | code |
|---|---|---|---|---|---|---|
| 1 | package DBIx::SchemaChecksum::App; | |||||
| 2 | 5 5 5 | 2110 9 130 | use 5.010; | |||
| 3 | 5 5 5 | 716 1426149 58 | use MooseX::App qw(Config); | |||
| 4 | extends qw(DBIx::SchemaChecksum); | |||||
| 5 | ||||||
| 6 | 5 5 5 | 2068394 16271 571 | use DBI; | |||
| 7 | ||||||
| 8 | option 'dsn' => ( | |||||
| 9 | isa => 'Str', | |||||
| 10 | is => 'ro', | |||||
| 11 | required => 1, | |||||
| 12 | documentation => q[DBI Data Source Name] | |||||
| 13 | ); | |||||
| 14 | option 'user' => ( | |||||
| 15 | isa => 'Str', | |||||
| 16 | is => 'ro', | |||||
| 17 | documentation => q[username to connect to database] | |||||
| 18 | ); | |||||
| 19 | option 'password' => ( | |||||
| 20 | isa => 'Str', | |||||
| 21 | is => 'ro', | |||||
| 22 | documentation => q[password to connect to database] | |||||
| 23 | ); | |||||
| 24 | option [qw(+catalog +schemata +tabletype)] => (); | |||||
| 25 | ||||||
| 26 | has '+dbh' => ( lazy_build => 1 ); | |||||
| 27 | ||||||
| 28 | sub _build_dbh { | |||||
| 29 | 5 | 9 | my $self = shift; | |||
| 30 | 5 | 116 | return DBI->connect( | |||
| 31 | $self->dsn, $self->user, $self->password, | |||||
| 32 | { RaiseError => 1 } # TODO: set dbi->connect opts via App | |||||
| 33 | ); | |||||
| 34 | } | |||||
| 35 | ||||||
| 36 | 1; | |||||