The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

DBIx::Class::Schema::Loader::Optional::Dependencies - Optional module dependency specifications (for module authors)

SYNOPSIS

Somewhere in your build-file (e.g. ExtUtils::MakeMaker's Makefile.PL):

  ...

  $EUMM_ARGS{CONFIGURE_REQUIRES} = {
    %{ $EUMM_ARGS{CONFIGURE_REQUIRES} || {} },
    'DBIx::Class::Schema::Loader' => '0.07052',
  };

  ...

  my %DBIC_CONFIG_AND_ORACLE_DEPS = %{ eval {
    require DBIx::Class::Schema::Loader::Optional::Dependencies;
    DBIx::Class::Schema::Loader::Optional::Dependencies->req_list_for([qw( dbicdump_config rdbms_oracle )]);
  } || {} };

  $EUMM_ARGS{PREREQ_PM} = {
    %DBIC_CONFIG_AND_ORACLE_DEPS,
    %{ $EUMM_ARGS{PREREQ_PM} || {} },
  };

  ...

  ExtUtils::MakeMaker::WriteMakefile(%EUMM_ARGS);

Note: The eval protection within the example is due to support for requirements during the configure build phase not being available on a sufficient portion of production installations of Perl. Robust support for such dependency requirements is available in the CPAN installer only since version 1.94_56 first made available for production with perl version 5.12. It is the belief of the current maintainer that support for requirements during the configure build phase will not be sufficiently ubiquitous until the year 2020 at the earliest, hence the extra care demonstrated above. It should also be noted that some 3rd party installers (e.g. cpanminus) do the right thing with configure requirements independent from the versions of perl and CPAN available.

DESCRIPTION

Some of the less-frequently used features of DBIx::Class::Schema::Loader have external module dependencies on their own. In order not to burden the average user with modules they will never use, these optional dependencies are not included in the base Makefile.PL. Instead an exception with a descriptive message is thrown when a specific feature can't find one or several modules required for its operation. This module is the central holding place for the current list of such dependencies, for DBIx::Class::Schema::Loader core authors, and DBIx::Class::Schema::Loader extension authors alike.

Dependencies are organized in groups where each group can list one or more required modules, with an optional minimum version (or 0 for any version). In addition groups prefixed with test_ can specify a set of environment variables, some (or all) of which are marked as required for the group to be considered by "req_list_for"

Each group name (or a combination thereof) can be used in the public methods as described below.

CURRENT REQUIREMENT GROUPS

dbicdump config file

dbicdump_config

Modules required for using a config file with dbicdump

  • Config::Any

Sybase ASE support

rdbms_ase

Modules required to connect to Sybase ASE

  • DBD::Sybase

DB2 support

rdbms_db2

Modules required to connect to DB2

  • DBD::DB2

Firebird support

rdbms_firebird

Modules required to connect to Firebird

  • DBD::Firebird

Firebird support via DBD::InterBase

rdbms_firebird_interbase

Modules required to connect to Firebird via DBD::InterBase

  • DBD::InterBase

Firebird support via DBD::ODBC

rdbms_firebird_odbc

Modules required to connect to Firebird via DBD::ODBC

  • DBD::ODBC

Informix support

rdbms_informix

Modules required to connect to Informix

  • DBD::Informix

MS Access support via DBD::ADO (Windows only)

rdbms_msaccess_ado

Modules required to connect to MS Access via DBD::ADO. This particular DBD is available on Windows only

  • DBD::ADO

MS Access support via DBD::ODBC

rdbms_msaccess_odbc

Modules required to connect to MS Access via DBD::ODBC

  • DBD::ODBC

MSSQL support via DBD::ADO (Windows only)

rdbms_mssql_ado

Modules required to connect to MSSQL via DBD::ADO. This particular DBD is available on Windows only

  • DBD::ADO

MSSQL support via DBD::ODBC

rdbms_mssql_odbc

Modules required to connect to MSSQL via DBD::ODBC

  • DBD::ODBC

MSSQL support via DBD::Sybase

rdbms_mssql_sybase

Modules required to connect to MSSQL via DBD::Sybase

  • DBD::Sybase

MySQL support

rdbms_mysql

Modules required to connect to MySQL

  • DBD::mysql

Oracle support

rdbms_oracle

Modules required to connect to Oracle

  • DBD::Oracle

  • Math::Base36 >= 0.07

  • Math::BigInt >= 1.80

PostgreSQL support

rdbms_pg

Modules required to connect to PostgreSQL

  • DBD::Pg

SQLAnywhere support

rdbms_sqlanywhere

Modules required to connect to SQLAnywhere

  • DBD::SQLAnywhere

SQLAnywhere support via DBD::ODBC

rdbms_sqlanywhere_odbc

Modules required to connect to SQLAnywhere via DBD::ODBC

  • DBD::ODBC

SQLite support

rdbms_sqlite

Modules required to connect to SQLite

  • DBD::SQLite

dbicdump config file testing

test_dbicdump_config

Modules required for using testing using a config file with dbicdump

  • Config::Any

  • Config::General

POD testing

test_pod

Modules required for testing POD in this distribution

  • Pod::Simple >= 3.22

  • Test::Pod >= 1.14

use_moose

use_moose

Modules required for the use_moose option (without only_autoclean)

  • Moose >= 1.12

  • MooseX::MarkAsMethods >= 0.13

  • MooseX::NonMoose >= 0.25

  • namespace::autoclean >= 0.09

use_moose_only_autoclean

use_moose_only_autoclean

Modules required for the use_moose + only_autoclean options

  • Moose >= 2.1400

  • MooseX::NonMoose >= 0.25

  • namespace::autoclean >= 0.09

IMPORT-LIKE ACTIONS

Even though this module is not an Exporter, it recognizes several actions supplied to its import method.

-skip_all_without

Arguments: @group_names

A convenience wrapper for use during testing:

 use DBIx::Class::Schema::Loader::Optional::Dependencies -skip_all_without => qw(admin test_rdbms_mysql);

Roughly equivalent to the following code:

 BEGIN {
   require DBIx::Class::Schema::Loader::Optional::Dependencies;
   if ( my $missing = DBIx::Class::Schema::Loader::Optional::Dependencies->req_missing_for(\@group_names_) ) {
     print "1..0 # SKIP requirements not satisfied: $missing\n";
     exit 0;
   }
 }

It also takes into account the RELEASE_TESTING environment variable and behaves like "-die_without" for any requirement groups marked as release_testing_mandatory.

-die_without

Arguments: @group_names

A convenience wrapper around "die_unless_req_ok_for":

 use DBIx::Class::Schema::Loader::Optional::Dependencies -die_without => qw(deploy admin);

-list_missing

Arguments: @group_names

A convenience wrapper around "modreq_missing_for":

 perl -Ilib -MDBIx::Class::Schema::Loader::Optional::Dependencies=-list_missing,dbicdump_config,rdbms_oracle | cpanm

METHODS

req_group_list

Arguments: none
Return Value: \%list_of_requirement_groups

This method should be used by DBIx::Class::Schema::Loader packagers, to get a hashref of all dependencies keyed by dependency group. Each key (group name), or a combination thereof (as an arrayref) can be supplied to the methods below. The values of the returned hash are currently a set of options without a well defined structure. If you have use for any of the contents - contact the maintainers, instead of treating this as public (left alone stable) API.

req_list_for

Arguments: $group_name | \@group_names
Return Value: \%set_of_module_version_pairs

This method should be used by DBIx::Class::Schema::Loader extension authors, to determine the version of modules a specific set of features requires for this version of DBIx::Class::Schema::Loader (regardless of their availability on the system). See the "SYNOPSIS" for a real-world example.

When handling test_* groups this method behaves differently from "modreq_list_for" below (and is the only such inconsistency among the req_* methods). If a particular group declares as requirements some environment variables and these requirements are not satisfied (the envvars are unset) - then the module requirements of this group are not included in the returned list.

modreq_list_for

Arguments: $group_name | \@group_names
Return Value: \%set_of_module_version_pairs

Same as "req_list_for" but does not take into consideration any environment variable requirements - returns just the list of required modules.

req_ok_for

Arguments: $group_name | \@group_names
Return Value: 1|0

Returns true or false depending on whether all modules/envvars required by the group(s) are loadable/set on the system.

req_missing_for

Arguments: $group_name | \@group_names
Return Value: $error_message_string

Returns a single-line string suitable for inclusion in larger error messages. This method would normally be used by DBIx::Class::Schema::Loader core features, to indicate to the user that they need to install specific modules and/or set specific environment variables before being able to use a specific feature set.

For example if some of the requirements for deploy are not available, the returned string could look like:

 "Moose~1.12" (see DBIx::Class::Schema::Loader::Optional::Dependencies documentation for details)

The author is expected to prepend the necessary text to this message before returning the actual error seen by the user. See also "modreq_missing_for"

modreq_missing_for

Arguments: $group_name | \@group_names
Return Value: $error_message_string

Same as "req_missing_for" except that the error string is guaranteed to be either empty, or contain a set of module requirement specifications suitable for piping to e.g. cpanminus. The method explicitly does not attempt to validate the state of required environment variables (if any).

For instance if some of the requirements for deploy are not available, the returned string could look like:

 "Moose~1.12"

See also "-list_missing".

skip_without

Arguments: $group_name | \@group_names

A convenience wrapper around skip. It does not take neither a reason (it is generated by "req_missing_for") nor an amount of skipped tests (it is always 1, thus mandating unconditional use of done_testing). Most useful in combination with ad hoc requirement specifications:

  SKIP: {
    DBIx::Class::Schema::Loader::Optional::Dependencies->skip_without([ deploy YAML>=0.90 ]);

    ...
  }

die_unless_req_ok_for

Arguments: $group_name | \@group_names

Checks if "req_ok_for" passes for the supplied group(s), and in case of failure throws an exception including the information from "req_missing_for". See also "-die_without".

modreq_errorlist_for

Arguments: $group_name | \@group_names
Return Value: \%set_of_loaderrors_per_module

Returns a hashref containing the actual errors that occurred while attempting to load each module in the requirement group(s).

req_errorlist_for

Deprecated method name, equivalent (via proxy) to "modreq_errorlist_for".

FURTHER QUESTIONS?

Check the list of additional DBIC resources.

COPYRIGHT AND LICENSE

This module is free software copyright by the DBIx::Class::Schema::Loader (DBICSL) authors. You can redistribute it and/or modify it under the same terms as the DBIx::Class::Schema::Loader library.