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 = {
109 'SQL::Statement' => '1.33',
114 'SQL::Statement' => '1.33',
118 'SQL::Statement' => '1.33',
122 'SQL::Statement' => '1.33',
124 my $rdbms_ss_anydata = {
125 ### XXX: DBD::AnyData 0.110 and DBI 1.623 conflict! ###
126 'DBD::AnyData' => '0',
127 'SQL::Statement' => '1.33',
129 my $rdbms_ss_treedata = {
130 ### XXX: DBD::AnyData 0.110 and DBI 1.623 conflict! ###
131 'DBD::TreeData' => '0',
132 'SQL::Statement' => '1.33',
139 title => 'Storage::Replicated',
140 desc => 'Modules required for L<DBIx::Class::Storage::DBI::Replicated>',
147 'Test::Moose' => '0',
157 title => 'DBIx::Class::Admin',
158 desc => 'Modules required for the DBIx::Class administrative library',
167 title => 'dbicadmin',
168 desc => 'Modules required for the CLI DBIx::Class interface dbicadmin',
174 'SQL::Translator' => '0.11016',
177 title => 'Storage::DBI::deploy()',
178 desc => 'Modules required for L<DBIx::Class::Storage::DBI/deploy> and L<DBIx::Class::Storage::DBI/deployment_statements>',
183 req => $id_shortener,
186 test_component_accessor => {
188 'Class::Unload' => '0.07',
194 'Test::Pod' => '1.41',
198 test_podcoverage => {
200 'Test::Pod::Coverage' => '1.08',
201 'Pod::Coverage' => '0.20',
207 'Test::EOL' => '1.0',
208 'Test::NoTabs' => '0.9',
214 'Test::Strict' => '0.20',
218 test_prettydebug => {
222 test_admin_script => {
228 # for t/admin/10script.t
229 ? ('Win32::ShellQuote' => 0)
230 # DWIW does not compile (./configure even) on win32
231 : ('JSON::DWIW' => 0 )
238 'Test::Memory::Cycle' => '0',
239 'Devel::Cycle' => '1.10',
244 req => $datetime_basic,
252 'DateTime::Format::SQLite' => '0',
259 # t/inflate/datetime_mysql.t
260 # (doesn't need Mysql itself)
261 'DateTime::Format::MySQL' => '0',
268 # t/inflate/datetime_pg.t
269 # (doesn't need PG itself)
270 'DateTime::Format::Pg' => '0.16004',
276 'Class::DBI::Plugin::DeepAbstractSearch' => '0',
278 'Time::Piece::MySQL' => '0',
279 'Date::Simple' => '3.03',
283 # this is just for completeness as SQLite
284 # is a core dep of DBIC for testing
290 title => 'SQLite support',
291 desc => 'Modules required to connect to SQLite',
297 # when changing this list make sure to adjust xt/optional_deps.t
301 title => 'PostgreSQL support',
302 desc => 'Modules required to connect to PostgreSQL',
306 rdbms_mssql_odbc => {
311 title => 'MSSQL support via DBD::ODBC',
312 desc => 'Modules required to connect to MSSQL via DBD::ODBC',
316 rdbms_mssql_sybase => {
318 %$rdbms_mssql_sybase,
321 title => 'MSSQL support via DBD::Sybase',
322 desc => 'Modules required to connect to MSSQL via DBD::Sybase',
331 title => 'MSSQL support via DBD::ADO (Windows only)',
332 desc => 'Modules required to connect to MSSQL via DBD::ADO. This particular DBD is available on Windows only',
336 rdbms_msaccess_odbc => {
338 %$rdbms_msaccess_odbc,
341 title => 'MS Access support via DBD::ODBC',
342 desc => 'Modules required to connect to MS Access via DBD::ODBC',
346 rdbms_msaccess_ado => {
348 %$rdbms_msaccess_ado,
351 title => 'MS Access support via DBD::ADO (Windows only)',
352 desc => 'Modules required to connect to MS Access via DBD::ADO. This particular DBD is available on Windows only',
361 title => 'MySQL support',
362 desc => 'Modules required to connect to MySQL',
371 title => 'Oracle support',
372 desc => 'Modules required to connect to Oracle',
381 title => 'Sybase ASE support',
382 desc => 'Modules required to connect to Sybase ASE',
391 title => 'DB2 support',
392 desc => 'Modules required to connect to DB2',
401 title => 'DB2 on AS/400 support',
402 desc => 'Modules required to connect to DB2 on AS/400',
411 title => 'Informix support',
412 desc => 'Modules required to connect to Informix',
416 rdbms_sqlanywhere => {
421 title => 'SQLAnywhere support',
422 desc => 'Modules required to connect to SQLAnywhere',
426 rdbms_sqlanywhere_odbc => {
428 %$rdbms_sqlanywhere_odbc,
431 title => 'SQLAnywhere support via DBD::ODBC',
432 desc => 'Modules required to connect to SQLAnywhere via DBD::ODBC',
441 title => 'Firebird support',
442 desc => 'Modules required to connect to Firebird',
446 rdbms_firebird_interbase => {
448 %$rdbms_firebird_interbase,
451 title => 'Firebird support via DBD::InterBase',
452 desc => 'Modules required to connect to Firebird via DBD::InterBase',
456 rdbms_firebird_odbc => {
458 %$rdbms_firebird_odbc,
461 title => 'Firebird support via DBD::ODBC',
462 desc => 'Modules required to connect to Firebird via DBD::ODBC',
471 title => 'CSV support via DBD::CSV',
472 desc => 'Modules required to connect to CSV files via DBD::CSV',
481 title => 'ML/DBM support via DBD::DBM',
482 desc => 'Modules required to connect to DBM & MLDBM files via DBD::DBM',
491 title => 'PO support via DBD::PO',
492 desc => 'Modules required to connect to PO files via DBD::PO',
501 title => 'System tables interface support via DBD::Sys',
502 desc => 'Modules required to connect to system tables via DBD::Sys',
506 rdbms_ss_anydata => {
511 title => 'Abstract flat data support via DBD::AnyData',
512 desc => 'Modules required to connect to abstract flat data via DBD::AnyData',
516 rdbms_ss_treedata => {
521 title => 'Abstract tree data support via DBD::TreeData',
522 desc => 'Modules required to connect to abstract tree data via DBD::TreeData',
526 # the order does matter because the rdbms support group might require
527 # a different version that the test group
530 $ENV{DBICTEST_PG_DSN}
532 # when changing this list make sure to adjust xt/optional_deps.t
534 ($^O ne 'MSWin32' ? ('Sys::SigAction' => '0') : ()),
535 'DBD::Pg' => '2.009002',
540 test_rdbms_mssql_odbc => {
542 $ENV{DBICTEST_MSSQL_ODBC_DSN}
549 test_rdbms_mssql_ado => {
551 $ENV{DBICTEST_MSSQL_ADO_DSN}
558 test_rdbms_mssql_sybase => {
560 $ENV{DBICTEST_MSSQL_DSN}
562 %$rdbms_mssql_sybase,
567 test_rdbms_msaccess_odbc => {
569 $ENV{DBICTEST_MSACCESS_ODBC_DSN}
571 %$rdbms_msaccess_odbc,
578 test_rdbms_msaccess_ado => {
580 $ENV{DBICTEST_MSACCESS_ADO_DSN}
582 %$rdbms_msaccess_ado,
589 test_rdbms_mysql => {
591 $ENV{DBICTEST_MYSQL_DSN}
598 test_rdbms_oracle => {
600 $ENV{DBICTEST_ORA_DSN}
603 'DateTime::Format::Oracle' => '0',
604 'DBD::Oracle' => '1.24',
611 $ENV{DBICTEST_SYBASE_DSN}
620 $ENV{DBICTEST_DB2_DSN}
627 test_rdbms_db2_400 => {
629 $ENV{DBICTEST_DB2_400_DSN}
636 test_rdbms_informix => {
638 $ENV{DBICTEST_INFORMIX_DSN}
645 test_rdbms_sqlanywhere => {
647 $ENV{DBICTEST_SQLANYWHERE_DSN}
654 test_rdbms_sqlanywhere_odbc => {
656 $ENV{DBICTEST_SQLANYWHERE_ODBC_DSN}
658 %$rdbms_sqlanywhere_odbc,
663 test_rdbms_firebird => {
665 $ENV{DBICTEST_FIREBIRD_DSN}
672 test_rdbms_firebird_interbase => {
674 $ENV{DBICTEST_FIREBIRD_INTERBASE_DSN}
676 %$rdbms_firebird_interbase,
681 test_rdbms_firebird_odbc => {
683 $ENV{DBICTEST_FIREBIRD_ODBC_DSN}
685 %$rdbms_firebird_odbc,
690 test_rdbms_ss_csv => {
696 test_rdbms_ss_dbm => {
702 test_rdbms_ss_po => {
704 $ENV{DBICTEST_DBD_PO}
711 test_rdbms_ss_sys => {
713 $ENV{DBICTEST_DBD_SYS}
720 test_rdbms_ss_anydata => {
722 $ENV{DBICTEST_DBD_ANYDATA}
729 test_rdbms_ss_treedata => {
731 $ENV{DBICTEST_DBD_TREEDATA}
740 $ENV{DBICTEST_MEMCACHED}
742 'Cache::Memcached' => 0,
749 'ExtUtils::MakeMaker' => '6.64',
750 'Pod::Inherit' => '0.90',
757 'CPAN::Uploader' => '0.103001',
763 our %req_availability_cache;
766 my ($class, $group) = @_;
768 Carp::croak "req_list_for() expects a requirement group name"
771 my $deps = $reqs->{$group}{req}
772 or Carp::croak "Requirement group '$group' does not exist";
778 sub die_unless_req_ok_for {
779 my ($class, $group) = @_;
781 Carp::croak "die_unless_req_ok_for() expects a requirement group name"
784 $class->_check_deps($group)->{status}
785 or die sprintf( "Required modules missing, unable to continue: %s\n", $class->_check_deps($group)->{missing} );
789 my ($class, $group) = @_;
791 Carp::croak "req_ok_for() expects a requirement group name"
794 return $class->_check_deps($group)->{status};
797 sub req_missing_for {
798 my ($class, $group) = @_;
800 Carp::croak "req_missing_for() expects a requirement group name"
803 return $class->_check_deps($group)->{missing};
806 sub req_errorlist_for {
807 my ($class, $group) = @_;
809 Carp::croak "req_errorlist_for() expects a requirement group name"
812 return $class->_check_deps($group)->{errorlist};
816 my ($class, $group) = @_;
818 return $req_availability_cache{$group} ||= do {
820 my $deps = $class->req_list_for ($group);
823 for my $mod (keys %$deps) {
824 my $req_line = "require $mod;";
825 if (my $ver = $deps->{$mod}) {
826 $req_line .= "$mod->VERSION($ver);";
831 $errors{$mod} = $@ if $@;
837 my $missing = join (', ', map { $deps->{$_} ? "$_ >= $deps->{$_}" : $_ } (sort keys %errors) );
838 $missing .= " (see $class for details)" if $reqs->{$group}{pod};
841 errorlist => \%errors,
858 return { map { $_ => { %{ $reqs->{$_}{req} || {} } } } (keys %$reqs) };
861 # This is to be called by the author only (automatically in Makefile.PL)
863 my ($class, $distver, $pod_dir) = @_;
865 die "No POD root dir supplied" unless $pod_dir;
868 eval { require DBIx::Class; DBIx::Class->VERSION; }
871 "\n\n---------------------------------------------------------------------\n" .
872 'Unable to load core DBIx::Class module to determine current version, '.
873 'possibly due to missing dependencies. Author-mode autodocumentation ' .
875 "\n\n---------------------------------------------------------------------\n"
878 # do not ask for a recent version, use 1.x API calls
879 # this *may* execute on a smoker with old perl or whatnot
882 (my $modfn = __PACKAGE__ . '.pm') =~ s|::|/|g;
884 (my $podfn = "$pod_dir/$modfn") =~ s/\.pm$/\.pod/;
885 (my $dir = $podfn) =~ s|/[^/]+$||;
887 File::Path::mkpath([$dir]);
889 my $sqltver = $class->req_list_for ('deploy')->{'SQL::Translator'}
890 or die "Hrmm? No sqlt dep?";
894 #########################################################################
895 ##################### A U T O G E N E R A T E D ########################
896 #########################################################################
898 # The contents of this POD file are auto-generated. Any changes you make
899 # will be lost. If you need to change the generated text edit _gen_pod()
900 # at the end of $modfn
904 "$class - Optional module dependency specifications (for module authors)",
907 Somewhere in your build-file (e.g. L<Module::Install>'s Makefile.PL):
911 configure_requires 'DBIx::Class' => '$distver';
915 my \$deploy_deps = $class->req_list_for('deploy');
917 for (keys %\$deploy_deps) {
918 requires \$_ => \$deploy_deps->{\$_};
923 Note that there are some caveats regarding C<configure_requires()>, more info
924 can be found at L<Module::Install/configure_requires>
926 '=head1 DESCRIPTION',
928 Some of the less-frequently used features of L<DBIx::Class> have external
929 module dependencies on their own. In order not to burden the average user
930 with modules he will never use, these optional dependencies are not included
931 in the base Makefile.PL. Instead an exception with a descriptive message is
932 thrown when a specific feature is missing one or several modules required for
933 its operation. This module is the central holding place for the current list
934 of such dependencies, for DBIx::Class core authors, and DBIx::Class extension
937 '=head1 CURRENT REQUIREMENT GROUPS',
939 Dependencies are organized in C<groups> and each group can list one or more
940 required modules, with an optional minimum version (or 0 for any version).
941 The group name can be used in the
945 for my $group (sort keys %$reqs) {
946 my $p = $reqs->{$group}{pod}
949 my $modlist = $reqs->{$group}{req}
952 next unless keys %$modlist;
955 "=head2 $p->{title}",
958 ( map { "=item * $_" . ($modlist->{$_} ? " >= $modlist->{$_}" : '') } (sort keys %$modlist) ),
960 "Requirement group: B<$group>",
966 '=head2 req_group_list',
968 '=item Arguments: none',
969 '=item Return Value: \%list_of_requirement_groups',
972 This method should be used by DBIx::Class packagers, to get a hashref of all
973 dependencies keyed by dependency group. Each key (group name) can be supplied
974 to one of the group-specific methods below.
977 '=head2 req_list_for',
979 '=item Arguments: $group_name',
980 '=item Return Value: \%list_of_module_version_pairs',
983 This method should be used by DBIx::Class extension authors, to determine the
984 version of modules a specific feature requires in the B<current> version of
985 DBIx::Class. See the L</SYNOPSIS> for a real-world
991 '=item Arguments: $group_name',
992 '=item Return Value: 1|0',
995 Returns true or false depending on whether all modules required by
996 C<$group_name> are present on the system and loadable.
999 '=head2 req_missing_for',
1001 '=item Arguments: $group_name',
1002 '=item Return Value: $error_message_string',
1005 Returns a single line string suitable for inclusion in larger error messages.
1006 This method would normally be used by DBIx::Class core-module author, to
1007 indicate to the user that he needs to install specific modules before he will
1008 be able to use a specific feature.
1010 For example if some of the requirements for C<deploy> are not available,
1011 the returned string could look like:
1013 SQL::Translator >= $sqltver (see $class for details)
1015 The author is expected to prepend the necessary text to this message before
1016 returning the actual error seen by the user.
1019 '=head2 die_unless_req_ok_for',
1021 '=item Arguments: $group_name',
1024 Checks if L</req_ok_for> passes for the supplied C<$group_name>, and
1025 in case of failure throws an exception including the information
1026 from L</req_missing_for>.
1029 '=head2 req_errorlist_for',
1031 '=item Arguments: $group_name',
1032 '=item Return Value: \%list_of_loaderrors_per_module',
1035 Returns a hashref containing the actual errors that occured while attempting
1036 to load each module in the requirement group.
1039 'See L<DBIx::Class/CONTRIBUTORS>.',
1041 'You may distribute this code under the same terms as Perl itself',
1044 open (my $fh, '>', $podfn) or Carp::croak "Unable to write to $podfn: $!";
1045 print $fh join ("\n\n", @chunks);