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 = {
112 title => 'Storage::Replicated',
113 desc => 'Modules required for L<DBIx::Class::Storage::DBI::Replicated>',
120 'Test::Moose' => '0',
130 title => 'DBIx::Class::Admin',
131 desc => 'Modules required for the DBIx::Class administrative library',
140 title => 'dbicadmin',
141 desc => 'Modules required for the CLI DBIx::Class interface dbicadmin',
147 'SQL::Translator' => '0.11016',
150 title => 'Storage::DBI::deploy()',
151 desc => 'Modules required for L<DBIx::Class::Storage::DBI/deploy> and L<DBIx::Class::Storage::DBI/deployment_statements>',
156 req => $id_shortener,
159 test_component_accessor => {
161 'Class::Unload' => '0.07',
167 'Test::Pod' => '1.41',
171 test_podcoverage => {
173 'Test::Pod::Coverage' => '1.08',
174 'Pod::Coverage' => '0.20',
180 'Test::EOL' => '1.0',
181 'Test::NoTabs' => '0.9',
187 'Test::Strict' => '0.20',
191 test_prettydebug => {
195 test_admin_script => {
201 # for t/admin/10script.t
202 ? ('Win32::ShellQuote' => 0)
203 # DWIW does not compile (./configure even) on win32
204 : ('JSON::DWIW' => 0 )
211 'Test::Memory::Cycle' => '0',
212 'Devel::Cycle' => '1.10',
217 req => $datetime_basic,
225 'DateTime::Format::SQLite' => '0',
232 # t/inflate/datetime_mysql.t
233 # (doesn't need Mysql itself)
234 'DateTime::Format::MySQL' => '0',
241 # t/inflate/datetime_pg.t
242 # (doesn't need PG itself)
243 'DateTime::Format::Pg' => '0.16004',
249 'Class::DBI::Plugin::DeepAbstractSearch' => '0',
251 'Time::Piece::MySQL' => '0',
252 'Date::Simple' => '3.03',
256 # this is just for completeness as SQLite
257 # is a core dep of DBIC for testing
263 title => 'SQLite support',
264 desc => 'Modules required to connect to SQLite',
270 # when changing this list make sure to adjust xt/optional_deps.t
274 title => 'PostgreSQL support',
275 desc => 'Modules required to connect to PostgreSQL',
279 rdbms_mssql_odbc => {
284 title => 'MSSQL support via DBD::ODBC',
285 desc => 'Modules required to connect to MSSQL via DBD::ODBC',
289 rdbms_mssql_sybase => {
291 %$rdbms_mssql_sybase,
294 title => 'MSSQL support via DBD::Sybase',
295 desc => 'Modules required to connect to MSSQL via DBD::Sybase',
304 title => 'MSSQL support via DBD::ADO (Windows only)',
305 desc => 'Modules required to connect to MSSQL via DBD::ADO. This particular DBD is available on Windows only',
309 rdbms_msaccess_odbc => {
311 %$rdbms_msaccess_odbc,
314 title => 'MS Access support via DBD::ODBC',
315 desc => 'Modules required to connect to MS Access via DBD::ODBC',
319 rdbms_msaccess_ado => {
321 %$rdbms_msaccess_ado,
324 title => 'MS Access support via DBD::ADO (Windows only)',
325 desc => 'Modules required to connect to MS Access via DBD::ADO. This particular DBD is available on Windows only',
334 title => 'MySQL support',
335 desc => 'Modules required to connect to MySQL',
344 title => 'Oracle support',
345 desc => 'Modules required to connect to Oracle',
354 title => 'Sybase ASE support',
355 desc => 'Modules required to connect to Sybase ASE',
364 title => 'DB2 support',
365 desc => 'Modules required to connect to DB2',
374 title => 'DB2 on AS/400 support',
375 desc => 'Modules required to connect to DB2 on AS/400',
384 title => 'Informix support',
385 desc => 'Modules required to connect to Informix',
389 rdbms_sqlanywhere => {
394 title => 'SQLAnywhere support',
395 desc => 'Modules required to connect to SQLAnywhere',
399 rdbms_sqlanywhere_odbc => {
401 %$rdbms_sqlanywhere_odbc,
404 title => 'SQLAnywhere support via DBD::ODBC',
405 desc => 'Modules required to connect to SQLAnywhere via DBD::ODBC',
414 title => 'Firebird support',
415 desc => 'Modules required to connect to Firebird',
419 rdbms_firebird_interbase => {
421 %$rdbms_firebird_interbase,
424 title => 'Firebird support via DBD::InterBase',
425 desc => 'Modules required to connect to Firebird via DBD::InterBase',
429 rdbms_firebird_odbc => {
431 %$rdbms_firebird_odbc,
434 title => 'Firebird support via DBD::ODBC',
435 desc => 'Modules required to connect to Firebird via DBD::ODBC',
439 # the order does matter because the rdbms support group might require
440 # a different version that the test group
443 $ENV{DBICTEST_PG_DSN}
445 # when changing this list make sure to adjust xt/optional_deps.t
447 ($^O ne 'MSWin32' ? ('Sys::SigAction' => '0') : ()),
448 'DBD::Pg' => '2.009002',
453 test_rdbms_mssql_odbc => {
455 $ENV{DBICTEST_MSSQL_ODBC_DSN}
462 test_rdbms_mssql_ado => {
464 $ENV{DBICTEST_MSSQL_ADO_DSN}
471 test_rdbms_mssql_sybase => {
473 $ENV{DBICTEST_MSSQL_DSN}
475 %$rdbms_mssql_sybase,
480 test_rdbms_msaccess_odbc => {
482 $ENV{DBICTEST_MSACCESS_ODBC_DSN}
484 %$rdbms_msaccess_odbc,
491 test_rdbms_msaccess_ado => {
493 $ENV{DBICTEST_MSACCESS_ADO_DSN}
495 %$rdbms_msaccess_ado,
502 test_rdbms_mysql => {
504 $ENV{DBICTEST_MYSQL_DSN}
511 test_rdbms_oracle => {
513 $ENV{DBICTEST_ORA_DSN}
516 'DateTime::Format::Oracle' => '0',
517 'DBD::Oracle' => '1.24',
524 $ENV{DBICTEST_SYBASE_DSN}
533 $ENV{DBICTEST_DB2_DSN}
540 test_rdbms_db2_400 => {
542 $ENV{DBICTEST_DB2_400_DSN}
549 test_rdbms_informix => {
551 $ENV{DBICTEST_INFORMIX_DSN}
558 test_rdbms_sqlanywhere => {
560 $ENV{DBICTEST_SQLANYWHERE_DSN}
567 test_rdbms_sqlanywhere_odbc => {
569 $ENV{DBICTEST_SQLANYWHERE_ODBC_DSN}
571 %$rdbms_sqlanywhere_odbc,
576 test_rdbms_firebird => {
578 $ENV{DBICTEST_FIREBIRD_DSN}
585 test_rdbms_firebird_interbase => {
587 $ENV{DBICTEST_FIREBIRD_INTERBASE_DSN}
589 %$rdbms_firebird_interbase,
594 test_rdbms_firebird_odbc => {
596 $ENV{DBICTEST_FIREBIRD_ODBC_DSN}
598 %$rdbms_firebird_odbc,
605 $ENV{DBICTEST_MEMCACHED}
607 'Cache::Memcached' => 0,
614 'ExtUtils::MakeMaker' => '6.64',
615 'Pod::Inherit' => '0.90',
622 'CPAN::Uploader' => '0.103001',
628 our %req_availability_cache;
631 my ($class, $group) = @_;
633 Carp::croak "req_list_for() expects a requirement group name"
636 my $deps = $reqs->{$group}{req}
637 or Carp::croak "Requirement group '$group' does not exist";
643 sub die_unless_req_ok_for {
644 my ($class, $group) = @_;
646 Carp::croak "die_unless_req_ok_for() expects a requirement group name"
649 $class->_check_deps($group)->{status}
650 or die sprintf( "Required modules missing, unable to continue: %s\n", $class->_check_deps($group)->{missing} );
654 my ($class, $group) = @_;
656 Carp::croak "req_ok_for() expects a requirement group name"
659 return $class->_check_deps($group)->{status};
662 sub req_missing_for {
663 my ($class, $group) = @_;
665 Carp::croak "req_missing_for() expects a requirement group name"
668 return $class->_check_deps($group)->{missing};
671 sub req_errorlist_for {
672 my ($class, $group) = @_;
674 Carp::croak "req_errorlist_for() expects a requirement group name"
677 return $class->_check_deps($group)->{errorlist};
681 my ($class, $group) = @_;
683 return $req_availability_cache{$group} ||= do {
685 my $deps = $class->req_list_for ($group);
688 for my $mod (keys %$deps) {
689 my $req_line = "require $mod;";
690 if (my $ver = $deps->{$mod}) {
691 $req_line .= "$mod->VERSION($ver);";
696 $errors{$mod} = $@ if $@;
702 my $missing = join (', ', map { $deps->{$_} ? "$_ >= $deps->{$_}" : $_ } (sort keys %errors) );
703 $missing .= " (see $class for details)" if $reqs->{$group}{pod};
706 errorlist => \%errors,
723 return { map { $_ => { %{ $reqs->{$_}{req} || {} } } } (keys %$reqs) };
726 # This is to be called by the author only (automatically in Makefile.PL)
728 my ($class, $distver, $pod_dir) = @_;
730 die "No POD root dir supplied" unless $pod_dir;
733 eval { require DBIx::Class; DBIx::Class->VERSION; }
736 "\n\n---------------------------------------------------------------------\n" .
737 'Unable to load core DBIx::Class module to determine current version, '.
738 'possibly due to missing dependencies. Author-mode autodocumentation ' .
740 "\n\n---------------------------------------------------------------------\n"
743 # do not ask for a recent version, use 1.x API calls
744 # this *may* execute on a smoker with old perl or whatnot
747 (my $modfn = __PACKAGE__ . '.pm') =~ s|::|/|g;
749 (my $podfn = "$pod_dir/$modfn") =~ s/\.pm$/\.pod/;
750 (my $dir = $podfn) =~ s|/[^/]+$||;
752 File::Path::mkpath([$dir]);
754 my $sqltver = $class->req_list_for ('deploy')->{'SQL::Translator'}
755 or die "Hrmm? No sqlt dep?";
759 #########################################################################
760 ##################### A U T O G E N E R A T E D ########################
761 #########################################################################
763 # The contents of this POD file are auto-generated. Any changes you make
764 # will be lost. If you need to change the generated text edit _gen_pod()
765 # at the end of $modfn
769 "$class - Optional module dependency specifications (for module authors)",
772 Somewhere in your build-file (e.g. L<Module::Install>'s Makefile.PL):
776 configure_requires 'DBIx::Class' => '$distver';
780 my \$deploy_deps = $class->req_list_for('deploy');
782 for (keys %\$deploy_deps) {
783 requires \$_ => \$deploy_deps->{\$_};
788 Note that there are some caveats regarding C<configure_requires()>, more info
789 can be found at L<Module::Install/configure_requires>
791 '=head1 DESCRIPTION',
793 Some of the less-frequently used features of L<DBIx::Class> have external
794 module dependencies on their own. In order not to burden the average user
795 with modules he will never use, these optional dependencies are not included
796 in the base Makefile.PL. Instead an exception with a descriptive message is
797 thrown when a specific feature is missing one or several modules required for
798 its operation. This module is the central holding place for the current list
799 of such dependencies, for DBIx::Class core authors, and DBIx::Class extension
802 '=head1 CURRENT REQUIREMENT GROUPS',
804 Dependencies are organized in C<groups> and each group can list one or more
805 required modules, with an optional minimum version (or 0 for any version).
806 The group name can be used in the
810 for my $group (sort keys %$reqs) {
811 my $p = $reqs->{$group}{pod}
814 my $modlist = $reqs->{$group}{req}
817 next unless keys %$modlist;
820 "=head2 $p->{title}",
823 ( map { "=item * $_" . ($modlist->{$_} ? " >= $modlist->{$_}" : '') } (sort keys %$modlist) ),
825 "Requirement group: B<$group>",
831 '=head2 req_group_list',
833 '=item Arguments: none',
834 '=item Return Value: \%list_of_requirement_groups',
837 This method should be used by DBIx::Class packagers, to get a hashref of all
838 dependencies keyed by dependency group. Each key (group name) can be supplied
839 to one of the group-specific methods below.
842 '=head2 req_list_for',
844 '=item Arguments: $group_name',
845 '=item Return Value: \%list_of_module_version_pairs',
848 This method should be used by DBIx::Class extension authors, to determine the
849 version of modules a specific feature requires in the B<current> version of
850 DBIx::Class. See the L</SYNOPSIS> for a real-world
856 '=item Arguments: $group_name',
857 '=item Return Value: 1|0',
860 Returns true or false depending on whether all modules required by
861 C<$group_name> are present on the system and loadable.
864 '=head2 req_missing_for',
866 '=item Arguments: $group_name',
867 '=item Return Value: $error_message_string',
870 Returns a single line string suitable for inclusion in larger error messages.
871 This method would normally be used by DBIx::Class core-module author, to
872 indicate to the user that he needs to install specific modules before he will
873 be able to use a specific feature.
875 For example if some of the requirements for C<deploy> are not available,
876 the returned string could look like:
878 SQL::Translator >= $sqltver (see $class for details)
880 The author is expected to prepend the necessary text to this message before
881 returning the actual error seen by the user.
884 '=head2 die_unless_req_ok_for',
886 '=item Arguments: $group_name',
889 Checks if L</req_ok_for> passes for the supplied C<$group_name>, and
890 in case of failure throws an exception including the information
891 from L</req_missing_for>.
894 '=head2 req_errorlist_for',
896 '=item Arguments: $group_name',
897 '=item Return Value: \%list_of_loaderrors_per_module',
900 Returns a hashref containing the actual errors that occured while attempting
901 to load each module in the requirement group.
904 'See L<DBIx::Class/CONTRIBUTORS>.',
906 'You may distribute this code under the same terms as Perl itself',
909 open (my $fh, '>', $podfn) or Carp::croak "Unable to write to $podfn: $!";
910 print $fh join ("\n\n", @chunks);