1 package DBIx::Class::Optional::Dependencies;
8 # NO EXTERNAL NON-5.8.1 CORE DEPENDENCIES EVER (e.g. C::A::G)
9 # This module is to be loaded by Makefile.PM on a pristine system
11 # POD is generated automatically by calling _gen_pod from the
12 # Makefile.PL in $AUTHOR mode
15 'JSON::Any' => '1.22',
20 'MooseX::Types' => '0.21',
30 'MooseX::Types::Path::Class' => '0.05',
31 'MooseX::Types::JSON' => '0.02',
32 'namespace::autoclean' => '0.09',
38 'Getopt::Long::Descriptive' => '0.081',
39 'Text::CSV' => '1.16',
42 my $datetime_basic = {
44 'DateTime::Format::Strptime' => '1.2',
48 'Math::BigInt' => '1.80',
49 'Math::Base36' => '0.07',
58 my $rdbms_mssql_odbc = {
61 my $rdbms_mssql_sybase = {
64 my $rdbms_mssql_ado = {
67 my $rdbms_msaccess_odbc = {
70 my $rdbms_msaccess_ado = {
89 my $rdbms_informix = {
90 'DBD::Informix' => '0',
92 my $rdbms_sqlanywhere = {
93 'DBD::SQLAnywhere' => '0',
95 my $rdbms_sqlanywhere_odbc = {
98 my $rdbms_firebird = {
99 'DBD::Firebird' => '0',
101 my $rdbms_firebird_interbase = {
102 'DBD::InterBase' => '0',
104 my $rdbms_firebird_odbc = {
111 'CPAN::Uploader' => '0.103001',
117 'Pod::Inherit' => '0.90',
125 title => 'Storage::Replicated',
126 desc => 'Modules required for L<DBIx::Class::Storage::DBI::Replicated>',
133 'Test::Moose' => '0',
143 title => 'DBIx::Class::Admin',
144 desc => 'Modules required for the DBIx::Class administrative library',
153 title => 'dbicadmin',
154 desc => 'Modules required for the CLI DBIx::Class interface dbicadmin',
160 'SQL::Translator' => '0.11016',
163 title => 'Storage::DBI::deploy()',
164 desc => 'Modules required for L<DBIx::Class::Storage::DBI/deploy> and L<DBIx::Class::Storage::DBI/deployment_statements>',
169 req => $id_shortener,
172 test_component_accessor => {
174 'Class::Unload' => '0.07',
180 'Test::Pod' => '1.41',
184 test_podcoverage => {
186 'Test::Pod::Coverage' => '1.08',
187 'Pod::Coverage' => '0.20',
193 'Test::EOL' => '1.0',
194 'Test::NoTabs' => '0.9',
200 'Test::Strict' => '0.20',
204 test_prettydebug => {
208 test_admin_script => {
214 # for t/admin/10script.t
215 ? ('Win32::ShellQuote' => 0)
216 # DWIW does not compile (./configure even) on win32
217 : ('JSON::DWIW' => 0 )
224 'Test::Memory::Cycle' => '0',
225 'Devel::Cycle' => '1.10',
230 req => $datetime_basic,
238 'DateTime::Format::SQLite' => '0',
245 # t/inflate/datetime_mysql.t
246 # (doesn't need Mysql itself)
247 'DateTime::Format::MySQL' => '0',
254 # t/inflate/datetime_pg.t
255 # (doesn't need PG itself)
256 'DateTime::Format::Pg' => '0.16004',
262 'Class::DBI::Plugin::DeepAbstractSearch' => '0',
264 'Time::Piece::MySQL' => '0',
265 'Date::Simple' => '3.03',
269 # this is just for completeness as SQLite
270 # is a core dep of DBIC for testing
276 title => 'SQLite support',
277 desc => 'Modules required to connect to SQLite',
283 # when changing this list make sure to adjust xt/optional_deps.t
287 title => 'PostgreSQL support',
288 desc => 'Modules required to connect to PostgreSQL',
292 rdbms_mssql_odbc => {
297 title => 'MSSQL support via DBD::ODBC',
298 desc => 'Modules required to connect to MSSQL via DBD::ODBC',
302 rdbms_mssql_sybase => {
304 %$rdbms_mssql_sybase,
307 title => 'MSSQL support via DBD::Sybase',
308 desc => 'Modules required to connect to MSSQL via DBD::Sybase',
317 title => 'MSSQL support via DBD::ADO (Windows only)',
318 desc => 'Modules required to connect to MSSQL via DBD::ADO. This particular DBD is available on Windows only',
322 rdbms_msaccess_odbc => {
324 %$rdbms_msaccess_odbc,
327 title => 'MS Access support via DBD::ODBC',
328 desc => 'Modules required to connect to MS Access via DBD::ODBC',
332 rdbms_msaccess_ado => {
334 %$rdbms_msaccess_ado,
337 title => 'MS Access support via DBD::ADO (Windows only)',
338 desc => 'Modules required to connect to MS Access via DBD::ADO. This particular DBD is available on Windows only',
347 title => 'MySQL support',
348 desc => 'Modules required to connect to MySQL',
357 title => 'Oracle support',
358 desc => 'Modules required to connect to Oracle',
367 title => 'Sybase ASE support',
368 desc => 'Modules required to connect to Sybase ASE',
377 title => 'DB2 support',
378 desc => 'Modules required to connect to DB2',
387 title => 'DB2 on AS/400 support',
388 desc => 'Modules required to connect to DB2 on AS/400',
397 title => 'Informix support',
398 desc => 'Modules required to connect to Informix',
402 rdbms_sqlanywhere => {
407 title => 'SQLAnywhere support',
408 desc => 'Modules required to connect to SQLAnywhere',
412 rdbms_sqlanywhere_odbc => {
414 %$rdbms_sqlanywhere_odbc,
417 title => 'SQLAnywhere support via DBD::ODBC',
418 desc => 'Modules required to connect to SQLAnywhere via DBD::ODBC',
427 title => 'Firebird support',
428 desc => 'Modules required to connect to Firebird',
432 rdbms_firebird_interbase => {
434 %$rdbms_firebird_interbase,
437 title => 'Firebird support via DBD::InterBase',
438 desc => 'Modules required to connect to Firebird via DBD::InterBase',
442 rdbms_firebird_odbc => {
444 %$rdbms_firebird_odbc,
447 title => 'Firebird support via DBD::ODBC',
448 desc => 'Modules required to connect to Firebird via DBD::ODBC',
452 # the order does matter because the rdbms support group might require
453 # a different version that the test group
456 $ENV{DBICTEST_PG_DSN}
458 # when changing this list make sure to adjust xt/optional_deps.t
460 ($^O ne 'MSWin32' ? ('Sys::SigAction' => '0') : ()),
461 'DBD::Pg' => '2.009002',
466 test_rdbms_mssql_odbc => {
468 $ENV{DBICTEST_MSSQL_ODBC_DSN}
475 test_rdbms_mssql_ado => {
477 $ENV{DBICTEST_MSSQL_ADO_DSN}
484 test_rdbms_mssql_sybase => {
486 $ENV{DBICTEST_MSSQL_DSN}
488 %$rdbms_mssql_sybase,
493 test_rdbms_msaccess_odbc => {
495 $ENV{DBICTEST_MSACCESS_ODBC_DSN}
497 %$rdbms_msaccess_odbc,
504 test_rdbms_msaccess_ado => {
506 $ENV{DBICTEST_MSACCESS_ADO_DSN}
508 %$rdbms_msaccess_ado,
515 test_rdbms_mysql => {
517 $ENV{DBICTEST_MYSQL_DSN}
524 test_rdbms_oracle => {
526 $ENV{DBICTEST_ORA_DSN}
529 'DateTime::Format::Oracle' => '0',
530 'DBD::Oracle' => '1.24',
537 $ENV{DBICTEST_SYBASE_DSN}
546 $ENV{DBICTEST_DB2_DSN}
553 test_rdbms_db2_400 => {
555 $ENV{DBICTEST_DB2_400_DSN}
562 test_rdbms_informix => {
564 $ENV{DBICTEST_INFORMIX_DSN}
571 test_rdbms_sqlanywhere => {
573 $ENV{DBICTEST_SQLANYWHERE_DSN}
580 test_rdbms_sqlanywhere_odbc => {
582 $ENV{DBICTEST_SQLANYWHERE_ODBC_DSN}
584 %$rdbms_sqlanywhere_odbc,
589 test_rdbms_firebird => {
591 $ENV{DBICTEST_FIREBIRD_DSN}
598 test_rdbms_firebird_interbase => {
600 $ENV{DBICTEST_FIREBIRD_INTERBASE_DSN}
602 %$rdbms_firebird_interbase,
607 test_rdbms_firebird_odbc => {
609 $ENV{DBICTEST_FIREBIRD_ODBC_DSN}
611 %$rdbms_firebird_odbc,
618 $ENV{DBICTEST_MEMCACHED}
620 'Cache::Memcached' => 0,
629 my ($class, $group) = @_;
631 Carp::croak "req_list_for() expects a requirement group name"
634 my $deps = $reqs->{$group}{req}
635 or Carp::croak "Requirement group '$group' does not exist";
641 our %req_availability_cache;
643 my ($class, $group) = @_;
645 Carp::croak "req_ok_for() expects a requirement group name"
648 return $class->_check_deps($group)->{status};
651 sub req_missing_for {
652 my ($class, $group) = @_;
654 Carp::croak "req_missing_for() expects a requirement group name"
657 return $class->_check_deps($group)->{missing};
660 sub req_errorlist_for {
661 my ($class, $group) = @_;
663 Carp::croak "req_errorlist_for() expects a requirement group name"
666 return $class->_check_deps($group)->{errorlist};
670 my ($class, $group) = @_;
672 return $req_availability_cache{$group} ||= do {
674 my $deps = $class->req_list_for ($group);
677 for my $mod (keys %$deps) {
678 my $req_line = "require $mod;";
679 if (my $ver = $deps->{$mod}) {
680 $req_line .= "$mod->VERSION($ver);";
685 $errors{$mod} = $@ if $@;
691 my $missing = join (', ', map { $deps->{$_} ? "$_ >= $deps->{$_}" : $_ } (sort keys %errors) );
692 $missing .= " (see $class for details)" if $reqs->{$group}{pod};
695 errorlist => \%errors,
712 return { map { $_ => { %{ $reqs->{$_}{req} || {} } } } (keys %$reqs) };
715 # This is to be called by the author only (automatically in Makefile.PL)
717 my ($class, $distver, $pod_dir) = @_;
719 die "No POD root dir supplied" unless $pod_dir;
722 eval { require DBIx::Class; DBIx::Class->VERSION; }
725 "\n\n---------------------------------------------------------------------\n" .
726 'Unable to load core DBIx::Class module to determine current version, '.
727 'possibly due to missing dependencies. Author-mode autodocumentation ' .
729 "\n\n---------------------------------------------------------------------\n"
732 # do not ask for a recent version, use 1.x API calls
733 # this *may* execute on a smoker with old perl or whatnot
736 (my $modfn = __PACKAGE__ . '.pm') =~ s|::|/|g;
738 (my $podfn = "$pod_dir/$modfn") =~ s/\.pm$/\.pod/;
739 (my $dir = $podfn) =~ s|/[^/]+$||;
741 File::Path::mkpath([$dir]);
743 my $sqltver = $class->req_list_for ('deploy')->{'SQL::Translator'}
744 or die "Hrmm? No sqlt dep?";
748 #########################################################################
749 ##################### A U T O G E N E R A T E D ########################
750 #########################################################################
752 # The contents of this POD file are auto-generated. Any changes you make
753 # will be lost. If you need to change the generated text edit _gen_pod()
754 # at the end of $modfn
758 "$class - Optional module dependency specifications (for module authors)",
761 Somewhere in your build-file (e.g. L<Module::Install>'s Makefile.PL):
765 configure_requires 'DBIx::Class' => '$distver';
769 my \$deploy_deps = $class->req_list_for('deploy');
771 for (keys %\$deploy_deps) {
772 requires \$_ => \$deploy_deps->{\$_};
777 Note that there are some caveats regarding C<configure_requires()>, more info
778 can be found at L<Module::Install/configure_requires>
780 '=head1 DESCRIPTION',
782 Some of the less-frequently used features of L<DBIx::Class> have external
783 module dependencies on their own. In order not to burden the average user
784 with modules he will never use, these optional dependencies are not included
785 in the base Makefile.PL. Instead an exception with a descriptive message is
786 thrown when a specific feature is missing one or several modules required for
787 its operation. This module is the central holding place for the current list
788 of such dependencies, for DBIx::Class core authors, and DBIx::Class extension
791 '=head1 CURRENT REQUIREMENT GROUPS',
793 Dependencies are organized in C<groups> and each group can list one or more
794 required modules, with an optional minimum version (or 0 for any version).
795 The group name can be used in the
799 for my $group (sort keys %$reqs) {
800 my $p = $reqs->{$group}{pod}
803 my $modlist = $reqs->{$group}{req}
806 next unless keys %$modlist;
809 "=head2 $p->{title}",
812 ( map { "=item * $_" . ($modlist->{$_} ? " >= $modlist->{$_}" : '') } (sort keys %$modlist) ),
814 "Requirement group: B<$group>",
820 '=head2 req_group_list',
822 '=item Arguments: none',
823 '=item Return Value: \%list_of_requirement_groups',
826 This method should be used by DBIx::Class packagers, to get a hashref of all
827 dependencies keyed by dependency group. Each key (group name) can be supplied
828 to one of the group-specific methods below.
831 '=head2 req_list_for',
833 '=item Arguments: $group_name',
834 '=item Return Value: \%list_of_module_version_pairs',
837 This method should be used by DBIx::Class extension authors, to determine the
838 version of modules a specific feature requires in the B<current> version of
839 DBIx::Class. See the L</SYNOPSIS> for a real-world
845 '=item Arguments: $group_name',
846 '=item Return Value: 1|0',
849 Returns true or false depending on whether all modules required by
850 C<$group_name> are present on the system and loadable.
853 '=head2 req_missing_for',
855 '=item Arguments: $group_name',
856 '=item Return Value: $error_message_string',
859 Returns a single line string suitable for inclusion in larger error messages.
860 This method would normally be used by DBIx::Class core-module author, to
861 indicate to the user that he needs to install specific modules before he will
862 be able to use a specific feature.
864 For example if some of the requirements for C<deploy> are not available,
865 the returned string could look like:
867 SQL::Translator >= $sqltver (see $class for details)
869 The author is expected to prepend the necessary text to this message before
870 returning the actual error seen by the user.
873 '=head2 req_errorlist_for',
875 '=item Arguments: $group_name',
876 '=item Return Value: \%list_of_loaderrors_per_module',
879 Returns a hashref containing the actual errors that occured while attempting
880 to load each module in the requirement group.
883 'See L<DBIx::Class/CONTRIBUTORS>.',
885 'You may distribute this code under the same terms as Perl itself',
888 open (my $fh, '>', $podfn) or Carp::croak "Unable to write to $podfn: $!";
889 print $fh join ("\n\n", @chunks);