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 'Pod::Inherit' => '0.90',
621 'CPAN::Uploader' => '0.103001',
627 our %req_availability_cache;
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 sub die_unless_req_ok_for {
643 my ($class, $group) = @_;
645 Carp::croak "die_unless_req_ok_for() expects a requirement group name"
648 $class->_check_deps($group)->{status}
649 or die sprintf( "Required modules missing, unable to continue: %s\n", $class->_check_deps($group)->{missing} );
653 my ($class, $group) = @_;
655 Carp::croak "req_ok_for() expects a requirement group name"
658 return $class->_check_deps($group)->{status};
661 sub req_missing_for {
662 my ($class, $group) = @_;
664 Carp::croak "req_missing_for() expects a requirement group name"
667 return $class->_check_deps($group)->{missing};
670 sub req_errorlist_for {
671 my ($class, $group) = @_;
673 Carp::croak "req_errorlist_for() expects a requirement group name"
676 return $class->_check_deps($group)->{errorlist};
680 my ($class, $group) = @_;
682 return $req_availability_cache{$group} ||= do {
684 my $deps = $class->req_list_for ($group);
687 for my $mod (keys %$deps) {
688 my $req_line = "require $mod;";
689 if (my $ver = $deps->{$mod}) {
690 $req_line .= "$mod->VERSION($ver);";
695 $errors{$mod} = $@ if $@;
701 my $missing = join (', ', map { $deps->{$_} ? "$_ >= $deps->{$_}" : $_ } (sort keys %errors) );
702 $missing .= " (see $class for details)" if $reqs->{$group}{pod};
705 errorlist => \%errors,
722 return { map { $_ => { %{ $reqs->{$_}{req} || {} } } } (keys %$reqs) };
725 # This is to be called by the author only (automatically in Makefile.PL)
727 my ($class, $distver, $pod_dir) = @_;
729 die "No POD root dir supplied" unless $pod_dir;
732 eval { require DBIx::Class; DBIx::Class->VERSION; }
735 "\n\n---------------------------------------------------------------------\n" .
736 'Unable to load core DBIx::Class module to determine current version, '.
737 'possibly due to missing dependencies. Author-mode autodocumentation ' .
739 "\n\n---------------------------------------------------------------------\n"
742 # do not ask for a recent version, use 1.x API calls
743 # this *may* execute on a smoker with old perl or whatnot
746 (my $modfn = __PACKAGE__ . '.pm') =~ s|::|/|g;
748 (my $podfn = "$pod_dir/$modfn") =~ s/\.pm$/\.pod/;
749 (my $dir = $podfn) =~ s|/[^/]+$||;
751 File::Path::mkpath([$dir]);
753 my $sqltver = $class->req_list_for ('deploy')->{'SQL::Translator'}
754 or die "Hrmm? No sqlt dep?";
758 #########################################################################
759 ##################### A U T O G E N E R A T E D ########################
760 #########################################################################
762 # The contents of this POD file are auto-generated. Any changes you make
763 # will be lost. If you need to change the generated text edit _gen_pod()
764 # at the end of $modfn
768 "$class - Optional module dependency specifications (for module authors)",
771 Somewhere in your build-file (e.g. L<Module::Install>'s Makefile.PL):
775 configure_requires 'DBIx::Class' => '$distver';
779 my \$deploy_deps = $class->req_list_for('deploy');
781 for (keys %\$deploy_deps) {
782 requires \$_ => \$deploy_deps->{\$_};
787 Note that there are some caveats regarding C<configure_requires()>, more info
788 can be found at L<Module::Install/configure_requires>
790 '=head1 DESCRIPTION',
792 Some of the less-frequently used features of L<DBIx::Class> have external
793 module dependencies on their own. In order not to burden the average user
794 with modules he will never use, these optional dependencies are not included
795 in the base Makefile.PL. Instead an exception with a descriptive message is
796 thrown when a specific feature is missing one or several modules required for
797 its operation. This module is the central holding place for the current list
798 of such dependencies, for DBIx::Class core authors, and DBIx::Class extension
801 '=head1 CURRENT REQUIREMENT GROUPS',
803 Dependencies are organized in C<groups> and each group can list one or more
804 required modules, with an optional minimum version (or 0 for any version).
805 The group name can be used in the
809 for my $group (sort keys %$reqs) {
810 my $p = $reqs->{$group}{pod}
813 my $modlist = $reqs->{$group}{req}
816 next unless keys %$modlist;
819 "=head2 $p->{title}",
822 ( map { "=item * $_" . ($modlist->{$_} ? " >= $modlist->{$_}" : '') } (sort keys %$modlist) ),
824 "Requirement group: B<$group>",
830 '=head2 req_group_list',
832 '=item Arguments: none',
833 '=item Return Value: \%list_of_requirement_groups',
836 This method should be used by DBIx::Class packagers, to get a hashref of all
837 dependencies keyed by dependency group. Each key (group name) can be supplied
838 to one of the group-specific methods below.
841 '=head2 req_list_for',
843 '=item Arguments: $group_name',
844 '=item Return Value: \%list_of_module_version_pairs',
847 This method should be used by DBIx::Class extension authors, to determine the
848 version of modules a specific feature requires in the B<current> version of
849 DBIx::Class. See the L</SYNOPSIS> for a real-world
855 '=item Arguments: $group_name',
856 '=item Return Value: 1|0',
859 Returns true or false depending on whether all modules required by
860 C<$group_name> are present on the system and loadable.
863 '=head2 req_missing_for',
865 '=item Arguments: $group_name',
866 '=item Return Value: $error_message_string',
869 Returns a single line string suitable for inclusion in larger error messages.
870 This method would normally be used by DBIx::Class core-module author, to
871 indicate to the user that he needs to install specific modules before he will
872 be able to use a specific feature.
874 For example if some of the requirements for C<deploy> are not available,
875 the returned string could look like:
877 SQL::Translator >= $sqltver (see $class for details)
879 The author is expected to prepend the necessary text to this message before
880 returning the actual error seen by the user.
883 '=head2 die_unless_req_ok_for',
885 '=item Arguments: $group_name',
888 Checks if L</req_ok_for> passes for the supplied C<$group_name>, and
889 in case of failure throws an exception including the information
890 from L</req_missing_for>.
893 '=head2 req_errorlist_for',
895 '=item Arguments: $group_name',
896 '=item Return Value: \%list_of_loaderrors_per_module',
899 Returns a hashref containing the actual errors that occured while attempting
900 to load each module in the requirement group.
903 'See L<DBIx::Class/CONTRIBUTORS>.',
905 'You may distribute this code under the same terms as Perl itself',
908 open (my $fh, '>', $podfn) or Carp::croak "Unable to write to $podfn: $!";
909 print $fh join ("\n\n", @chunks);