use OO interface of Hash::Merge for ::DBI::Replicated
[dbsrgits/DBIx-Class.git] / lib / DBIx / Class / Optional / Dependencies.pm
index 50f70a9..c1a4fe4 100644 (file)
@@ -16,6 +16,14 @@ my $moose_basic = {
   'MooseX::Types'              => '0.21',
 };
 
+my $admin_basic = {
+  %$moose_basic,
+  'MooseX::Types::Path::Class' => '0.05',
+  'MooseX::Types::JSON'        => '0.02',
+  'JSON::Any'                  => '1.22',
+  'namespace::autoclean'       => '0.09',
+};
+
 my $reqs = {
   dist => {
     #'Module::Install::Pod::Inherit' => '0.01',
@@ -25,7 +33,7 @@ my $reqs = {
     req => {
       %$moose_basic,
       'namespace::clean'          => '0.11',
-      'Hash::Merge'               => '0.11',
+      'Hash::Merge'               => '0.12',
     },
     pod => {
       title => 'Storage::Replicated',
@@ -35,13 +43,19 @@ my $reqs = {
 
   admin => {
     req => {
+      %$admin_basic,
+    },
+    pod => {
+      title => 'DBIx::Class::Admin',
+      desc => 'Modules required for the DBIx::Class administrative library',
+    },
+  },
+
+  admin_script => {
+    req => {
       %$moose_basic,
-      'MooseX::Types::Path::Class'=> '0.05',
-      'MooseX::Types::JSON'       => '0.02',
-      'namespace::autoclean'      => '0.09',
-      'parent'                    => '0.223',
+      %$admin_basic,
       'Getopt::Long::Descriptive' => '0.081',
-      'JSON::Any'                 => '1.22',
       'Text::CSV'                 => '1.16',
     },
     pod => {
@@ -137,7 +151,7 @@ my $reqs = {
 
   rdbms_asa => {
     req => {
-      grep $_, @ENV{qw/DBICTEST_SYBASE_ASA_DSN DBICTEST_SYBASE_ASA_ODBC_DSN/}
+      (scalar grep $_, @ENV{qw/DBICTEST_SYBASE_ASA_DSN DBICTEST_SYBASE_ASA_ODBC_DSN/})
         ? (
           'DateTime::Format::Strptime' => 0,
         ) : ()
@@ -232,12 +246,51 @@ sub _check_deps {
   }
 }
 
+# This is to be called by the author onbly (automatically in Makefile.PL)
 sub _gen_pod {
   my $class = shift;
+  my $modfn = __PACKAGE__ . '.pm';
+  $modfn =~ s/\:\:/\//g;
+
+  require DBIx::Class;
+  my $distver = DBIx::Class->VERSION;
 
   my @chunks = (
+    <<"EOC",
+#########################################################################
+#####################  A U T O G E N E R A T E D ########################
+#########################################################################
+#
+# The contents of this POD file are auto-generated.  Any changes you make
+# will be lost. If you need to change the generated text edit _gen_pod()
+# at the end of $modfn
+#
+EOC
     '=head1 NAME',
-    "$class - Optional module dependency specifications",
+    "$class - Optional module dependency specifications (for module authors)",
+    '=head1 SYNOPSIS (EXPERIMENTAL)',
+    <<EOS,
+B<THE USAGE SHOWN HERE IS EXPERIMENTAL>
+
+Somewhere in your build-file (e.g. L<Module::Install>'s Makefile.PL):
+
+  ...
+
+  configure_requires 'DBIx::Class' => '$distver';
+
+  require $class;
+
+  my \$deploy_deps = $class->req_list_for ('deploy');
+
+  for (keys %\$deploy_deps) {
+    requires \$_ => \$deploy_deps->{\$_};
+  }
+
+  ...
+
+Note that there are some caveats regarding C<configure_requires()>, more info
+can be found at L<Module::Install/configure_requires>
+EOS
     '=head1 DESCRIPTION',
     <<'EOD',
 Some of the less-frequently used features of L<DBIx::Class> have external
@@ -246,7 +299,8 @@ with modules he will never use, these optional dependencies are not included
 in the base Makefile.PL. Instead an exception with a descriptive message is
 thrown when a specific feature is missing one or several modules required for
 its operation. This module is the central holding place for  the current list
-of such dependencies.
+of such dependencies, for DBIx::Class core authors, and DBIx::Class extension
+authors alike.
 EOD
     '=head1 CURRENT REQUIREMENT GROUPS',
     <<'EOD',
@@ -284,17 +338,9 @@ EOD
     '=back',
     <<EOD,
 This method should be used by DBIx::Class extension authors, to determine the
-version of modules which a specific feature requires in the current version of
-DBIx::Class. For example if you write a module/extension that requires
-DBIx::Class and also requires the availability of
-L<DBIx::Class::Storage::DBI/deploy>, you can do the following in your
-C<Makefile.PL> or C<Build.PL>
-
- require $class;
- my \$dep_list = $class->req_list_for ('deploy');
-
-Which will give you a list of module/version pairs necessary for the particular
-feature to function with this version of DBIx::Class.
+version of modules a specific feature requires in the B<current> version of
+DBIx::Class. See the L<SYNOPSIS|/SYNOPSIS (EXPERIMENTAL)> for a real-world
+example.
 EOD
 
     '=head2 req_ok_for',
@@ -302,7 +348,7 @@ EOD
     '=item Arguments: $group_name',
     '=item Returns: 1|0',
     '=back',
-    'Returns true or false depending on whether all modules required by $group_name are present on the system and loadable',
+    'Returns true or false depending on whether all modules required by C<$group_name> are present on the system and loadable',
 
     '=head2 req_missing_for',
     '=over',
@@ -333,7 +379,10 @@ EOD
 Returns a hashref containing the actual errors that occured while attempting
 to load each module in the requirement group.
 EOD
-
+    '=head1 AUTHOR',
+    'See L<DBIx::Class/CONTRIBUTORS>.',
+    '=head1 LICENSE',
+    'You may distribute this code under the same terms as Perl itself',
   );
 
   my $fn = __FILE__;