Switch tests to Optional::Deps
[dbsrgits/DBIx-Class.git] / lib / DBIx / Class / Admin.pm
index 862143f..8814bf7 100644 (file)
@@ -25,21 +25,30 @@ use Moose;
 use parent 'DBIx::Class::Schema';
 use Carp::Clan qw/^DBIx::Class/;
 
-use MooseX::Types::Moose qw/Int HashRef ArrayRef Str Any Bool/;
-use DBIx::Class::Admin::Types qw/DBICConnectInfo/;
+use MooseX::Types::Moose qw/Int Str Any Bool/;
+use DBIx::Class::Admin::Types qw/DBICConnectInfo DBICHashRef/;
 use MooseX::Types::JSON qw(JSON);
 use MooseX::Types::Path::Class qw(Dir File);
 use Try::Tiny;
-use JSON::Any;
+use JSON::Any qw(DWIW XS JSON);
 use namespace::autoclean;
 
-
 =head1 NAME
 
 DBIx::Class::Admin - Administration object for schemas
 
 =head1 SYNOPSIS
 
+  $ dbicadmin --help
+
+  $ dbicadmin --schema=MyApp::Schema \
+    --connect='["dbi:SQLite:my.db", "", ""]' \
+    --deploy
+
+  $ dbicadmin --schema=MyApp::Schema --class=Employee \
+    --connect='["dbi:SQLite:my.db", "", ""]' \
+    --op=update --set='{ "name": "New_Employee" }'
+
   use DBIx::Class::Admin;
 
   # ddl manipulation
@@ -61,6 +70,32 @@ DBIx::Class::Admin - Administration object for schemas
   # install a version for an unversioned schema
   $admin->install("3.0");
 
+=head1 REQUIREMENTS
+
+The following CPAN modules are required to use C<dbicadmin> and this module:
+
+L<Moose>
+
+L<MooseX::Types>
+
+L<MooseX::Types::JSON>
+
+L<MooseX::Types::Path::Class>
+
+L<Try::Tiny>
+
+L<parent>
+
+L<JSON::Any>
+
+(L<JSON::DWIW> preferred for barekey support)
+
+L<namespace::autoclean>
+
+L<Getopt::Long::Descriptive>
+
+L<Text::CSV>
+
 =head1 Attributes
 
 =head2 schema_class
@@ -72,7 +107,6 @@ the class of the schema to load
 has 'schema_class' => (
   is    => 'ro',
   isa    => Str,
-  coerce  => 1,
 );
 
 
@@ -117,7 +151,7 @@ a hash ref or json string to be used for identifying data to manipulate
 
 has 'where' => (
   is      => 'rw',
-  isa      => HashRef,
+  isa      => DBICHashRef,
   coerce    => 1,
 );
 
@@ -130,7 +164,7 @@ a hash ref or json string to be used for inserting or updating data
 
 has 'set' => (
   is      => 'rw',
-  isa      => HashRef,
+  isa      => DBICHashRef,
   coerce    => 1,
 );
 
@@ -143,7 +177,7 @@ a hash ref or json string to be used for passing additonal info to the ->search
 
 has 'attrs' => (
   is       => 'rw',
-  isa      => HashRef,
+  isa      => DBICHashRef,
   coerce    => 1,
 );
 
@@ -204,13 +238,15 @@ config_stanza will still be required.
 
 has config => (
   is      => 'ro',
-  isa      => HashRef,
+  isa      => DBICHashRef,
   lazy_build  => 1,
 );
 
 sub _build_config {
   my ($self) = @_;
-  try { require Config::Any } catch { $self->throw_exception( "Config::Any is required to parse the config file"); };
+
+  eval { require Config::Any }
+    or $self->throw_exception( "Config::Any is required to parse the config file");
 
   my $cfg = Config::Any->load_files ( {files => [$self->config_file], use_ext =>1, flatten_to_hash=>1});
 
@@ -555,7 +591,7 @@ sub _find_stanza {
   return $cfg;
 }
 
-=head1 AUTHORS
+=head1 AUTHOR
 
 See L<DBIx::Class/CONTRIBUTORS>.