« blib/lib/App/DBCritic/Policy/DuplicateRelationships.pm
↑ Summary
blib/lib/App/DBCritic/Loader.pm »
| 1 | #!/usr/bin/env perl | ||||||||||
| 2 | |||||||||||
| 3 | package main; | ||||||||||
| 4 | 1 | ▶ | use Modern::Perl '2011'; ## no critic (Modules::ProhibitUseQuotedVersion) | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 5 | 1 | ▶ | use utf8; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 6 | |||||||||||
| 7 | 1 | our $VERSION = '0.023'; # VERSION | |||||||||
| 8 | 1 | ▶ | use Getopt::Long::Descriptive; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 9 | 1 | ▶ | use App::DBCritic; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 10 | |||||||||||
| 11 | 1 | my ( $opt, $usage ) = describe_options( | |||||||||
| 12 | '%c %o', | ||||||||||
| 13 | [ 'dsn|d=s' => 'DBI data source name' ], | ||||||||||
| 14 | [ 'username|user|u:s' => 'name of user to use to connect to database' ], | ||||||||||
| 15 | [ 'password|pass|p:s' => 'password for connecting to database' ], | ||||||||||
| 16 | [ 'class_name|class|c:s' => | ||||||||||
| 17 | 'DBIx::Class::Schema to use rather than generating one', | ||||||||||
| 18 | ], | ||||||||||
| 19 | [ 'help|h' => 'print usage message and exit' ], | ||||||||||
| 20 | ); | ||||||||||
| 21 | |||||||||||
| 22 | 1 | ▶ | if ( $opt->help ) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 23 | 0 | print $usage->text; | |||||||||
| 24 | 0 | exit; | |||||||||
| 25 | } | ||||||||||
| 26 | |||||||||||
| 27 | my $critic = App::DBCritic->new( | ||||||||||
| 28 | 1 | map { $_ => $opt->$_ } | |||||||||
| 29 | 1 | grep { defined $opt->$_ } qw(dsn username password class_name), | |||||||||
| 30 | ); | ||||||||||
| 31 | 1 | $critic->critique(); | |||||||||
| 32 | |||||||||||
| 33 | # PODNAME: dbcritic | ||||||||||
| 34 | # ABSTRACT: Critique a database schema for best practices | ||||||||||
| 35 | |||||||||||
| 36 | __END__ | ||||||||||