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.16',
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',
263 'Class::DBI::Plugin::DeepAbstractSearch' => '0',
265 'Time::Piece::MySQL' => '0',
266 'Date::Simple' => '3.03',
270 # this is just for completeness as SQLite
271 # is a core dep of DBIC for testing
277 title => 'SQLite support',
278 desc => 'Modules required to connect to SQLite',
284 # when changing this list make sure to adjust xt/optional_deps.t
288 title => 'PostgreSQL support',
289 desc => 'Modules required to connect to PostgreSQL',
293 rdbms_mssql_odbc => {
298 title => 'MSSQL support via DBD::ODBC',
299 desc => 'Modules required to connect to MSSQL via DBD::ODBC',
303 rdbms_mssql_sybase => {
305 %$rdbms_mssql_sybase,
308 title => 'MSSQL support via DBD::Sybase',
309 desc => 'Modules required to connect to MSSQL via DBD::Sybase',
318 title => 'MSSQL support via DBD::ADO (Windows only)',
319 desc => 'Modules required to connect to MSSQL via DBD::ADO. This particular DBD is available on Windows only',
323 rdbms_msaccess_odbc => {
325 %$rdbms_msaccess_odbc,
328 title => 'MS Access support via DBD::ODBC',
329 desc => 'Modules required to connect to MS Access via DBD::ODBC',
333 rdbms_msaccess_ado => {
335 %$rdbms_msaccess_ado,
338 title => 'MS Access support via DBD::ADO (Windows only)',
339 desc => 'Modules required to connect to MS Access via DBD::ADO. This particular DBD is available on Windows only',
348 title => 'MySQL support',
349 desc => 'Modules required to connect to MySQL',
358 title => 'Oracle support',
359 desc => 'Modules required to connect to Oracle',
368 title => 'Sybase ASE support',
369 desc => 'Modules required to connect to Sybase ASE',
378 title => 'DB2 support',
379 desc => 'Modules required to connect to DB2',
388 title => 'DB2 on AS/400 support',
389 desc => 'Modules required to connect to DB2 on AS/400',
398 title => 'Informix support',
399 desc => 'Modules required to connect to Informix',
403 rdbms_sqlanywhere => {
408 title => 'SQLAnywhere support',
409 desc => 'Modules required to connect to SQLAnywhere',
413 rdbms_sqlanywhere_odbc => {
415 %$rdbms_sqlanywhere_odbc,
418 title => 'SQLAnywhere support via DBD::ODBC',
419 desc => 'Modules required to connect to SQLAnywhere via DBD::ODBC',
428 title => 'Firebird support',
429 desc => 'Modules required to connect to Firebird',
433 rdbms_firebird_interbase => {
435 %$rdbms_firebird_interbase,
438 title => 'Firebird support via DBD::InterBase',
439 desc => 'Modules required to connect to Firebird via DBD::InterBase',
443 rdbms_firebird_odbc => {
445 %$rdbms_firebird_odbc,
448 title => 'Firebird support via DBD::ODBC',
449 desc => 'Modules required to connect to Firebird via DBD::ODBC',
453 # the order does matter because the rdbms support group might require
454 # a different version that the test group
457 $ENV{DBICTEST_PG_DSN}
459 # when changing this list make sure to adjust xt/optional_deps.t
461 ($^O ne 'MSWin32' ? ('Sys::SigAction' => '0') : ()),
462 'DBD::Pg' => '2.009002',
467 test_rdbms_mssql_odbc => {
469 $ENV{DBICTEST_MSSQL_ODBC_DSN}
476 test_rdbms_mssql_ado => {
478 $ENV{DBICTEST_MSSQL_ADO_DSN}
485 test_rdbms_mssql_sybase => {
487 $ENV{DBICTEST_MSSQL_DSN}
489 %$rdbms_mssql_sybase,
494 test_rdbms_msaccess_odbc => {
496 $ENV{DBICTEST_MSACCESS_ODBC_DSN}
498 %$rdbms_msaccess_odbc,
505 test_rdbms_msaccess_ado => {
507 $ENV{DBICTEST_MSACCESS_ADO_DSN}
509 %$rdbms_msaccess_ado,
516 test_rdbms_mysql => {
518 $ENV{DBICTEST_MYSQL_DSN}
525 test_rdbms_oracle => {
527 $ENV{DBICTEST_ORA_DSN}
530 'DateTime::Format::Oracle' => '0',
531 'DBD::Oracle' => '1.24',
538 $ENV{DBICTEST_SYBASE_DSN}
547 $ENV{DBICTEST_DB2_DSN}
554 test_rdbms_db2_400 => {
556 $ENV{DBICTEST_DB2_400_DSN}
563 test_rdbms_informix => {
565 $ENV{DBICTEST_INFORMIX_DSN}
572 test_rdbms_sqlanywhere => {
574 $ENV{DBICTEST_SQLANYWHERE_DSN}
581 test_rdbms_sqlanywhere_odbc => {
583 $ENV{DBICTEST_SQLANYWHERE_ODBC_DSN}
585 %$rdbms_sqlanywhere_odbc,
590 test_rdbms_firebird => {
592 $ENV{DBICTEST_FIREBIRD_DSN}
599 test_rdbms_firebird_interbase => {
601 $ENV{DBICTEST_FIREBIRD_INTERBASE_DSN}
603 %$rdbms_firebird_interbase,
608 test_rdbms_firebird_odbc => {
610 $ENV{DBICTEST_FIREBIRD_ODBC_DSN}
612 %$rdbms_firebird_odbc,
619 $ENV{DBICTEST_MEMCACHED}
621 'Cache::Memcached' => 0,
630 my ($class, $group) = @_;
632 Carp::croak "req_list_for() expects a requirement group name"
635 my $deps = $reqs->{$group}{req}
636 or Carp::croak "Requirement group '$group' does not exist";
642 our %req_availability_cache;
644 my ($class, $group) = @_;
646 Carp::croak "req_ok_for() expects a requirement group name"
649 return $class->_check_deps($group)->{status};
652 sub req_missing_for {
653 my ($class, $group) = @_;
655 Carp::croak "req_missing_for() expects a requirement group name"
658 return $class->_check_deps($group)->{missing};
661 sub req_errorlist_for {
662 my ($class, $group) = @_;
664 Carp::croak "req_errorlist_for() expects a requirement group name"
667 return $class->_check_deps($group)->{errorlist};
671 my ($class, $group) = @_;
673 return $req_availability_cache{$group} ||= do {
675 my $deps = $class->req_list_for ($group);
678 for my $mod (keys %$deps) {
679 my $req_line = "require $mod;";
680 if (my $ver = $deps->{$mod}) {
681 $req_line .= "$mod->VERSION($ver);";
686 $errors{$mod} = $@ if $@;
692 my $missing = join (', ', map { $deps->{$_} ? "$_ >= $deps->{$_}" : $_ } (sort keys %errors) );
693 $missing .= " (see $class for details)" if $reqs->{$group}{pod};
696 errorlist => \%errors,
713 return { map { $_ => { %{ $reqs->{$_}{req} || {} } } } (keys %$reqs) };
716 # This is to be called by the author only (automatically in Makefile.PL)
718 my ($class, $distver, $pod_dir) = @_;
720 die "No POD root dir supplied" unless $pod_dir;
723 eval { require DBIx::Class; DBIx::Class->VERSION; }
726 "\n\n---------------------------------------------------------------------\n" .
727 'Unable to load core DBIx::Class module to determine current version, '.
728 'possibly due to missing dependencies. Author-mode autodocumentation ' .
730 "\n\n---------------------------------------------------------------------\n"
733 # do not ask for a recent version, use 1.x API calls
734 # this *may* execute on a smoker with old perl or whatnot
737 (my $modfn = __PACKAGE__ . '.pm') =~ s|::|/|g;
739 (my $podfn = "$pod_dir/$modfn") =~ s/\.pm$/\.pod/;
740 (my $dir = $podfn) =~ s|/[^/]+$||;
742 File::Path::mkpath([$dir]);
744 my $sqltver = $class->req_list_for ('deploy')->{'SQL::Translator'}
745 or die "Hrmm? No sqlt dep?";
749 #########################################################################
750 ##################### A U T O G E N E R A T E D ########################
751 #########################################################################
753 # The contents of this POD file are auto-generated. Any changes you make
754 # will be lost. If you need to change the generated text edit _gen_pod()
755 # at the end of $modfn
759 "$class - Optional module dependency specifications (for module authors)",
762 Somewhere in your build-file (e.g. L<Module::Install>'s Makefile.PL):
766 configure_requires 'DBIx::Class' => '$distver';
770 my \$deploy_deps = $class->req_list_for('deploy');
772 for (keys %\$deploy_deps) {
773 requires \$_ => \$deploy_deps->{\$_};
778 Note that there are some caveats regarding C<configure_requires()>, more info
779 can be found at L<Module::Install/configure_requires>
781 '=head1 DESCRIPTION',
783 Some of the less-frequently used features of L<DBIx::Class> have external
784 module dependencies on their own. In order not to burden the average user
785 with modules he will never use, these optional dependencies are not included
786 in the base Makefile.PL. Instead an exception with a descriptive message is
787 thrown when a specific feature is missing one or several modules required for
788 its operation. This module is the central holding place for the current list
789 of such dependencies, for DBIx::Class core authors, and DBIx::Class extension
792 '=head1 CURRENT REQUIREMENT GROUPS',
794 Dependencies are organized in C<groups> and each group can list one or more
795 required modules, with an optional minimum version (or 0 for any version).
796 The group name can be used in the
800 for my $group (sort keys %$reqs) {
801 my $p = $reqs->{$group}{pod}
804 my $modlist = $reqs->{$group}{req}
807 next unless keys %$modlist;
810 "=head2 $p->{title}",
813 ( map { "=item * $_" . ($modlist->{$_} ? " >= $modlist->{$_}" : '') } (sort keys %$modlist) ),
815 "Requirement group: B<$group>",
821 '=head2 req_group_list',
823 '=item Arguments: none',
824 '=item Return Value: \%list_of_requirement_groups',
827 This method should be used by DBIx::Class packagers, to get a hashref of all
828 dependencies keyed by dependency group. Each key (group name) can be supplied
829 to one of the group-specific methods below.
832 '=head2 req_list_for',
834 '=item Arguments: $group_name',
835 '=item Return Value: \%list_of_module_version_pairs',
838 This method should be used by DBIx::Class extension authors, to determine the
839 version of modules a specific feature requires in the B<current> version of
840 DBIx::Class. See the L</SYNOPSIS> for a real-world
846 '=item Arguments: $group_name',
847 '=item Return Value: 1|0',
850 Returns true or false depending on whether all modules required by
851 C<$group_name> are present on the system and loadable.
854 '=head2 req_missing_for',
856 '=item Arguments: $group_name',
857 '=item Return Value: $error_message_string',
860 Returns a single line string suitable for inclusion in larger error messages.
861 This method would normally be used by DBIx::Class core-module author, to
862 indicate to the user that he needs to install specific modules before he will
863 be able to use a specific feature.
865 For example if some of the requirements for C<deploy> are not available,
866 the returned string could look like:
868 SQL::Translator >= $sqltver (see $class for details)
870 The author is expected to prepend the necessary text to this message before
871 returning the actual error seen by the user.
874 '=head2 req_errorlist_for',
876 '=item Arguments: $group_name',
877 '=item Return Value: \%list_of_loaderrors_per_module',
880 Returns a hashref containing the actual errors that occured while attempting
881 to load each module in the requirement group.
884 'See L<DBIx::Class/CONTRIBUTORS>.',
886 'You may distribute this code under the same terms as Perl itself',
889 open (my $fh, '>', $podfn) or Carp::croak "Unable to write to $podfn: $!";
890 print $fh join ("\n\n", @chunks);