DBIx::Class::Schema::Loader::Optional::Dependencies - Optional module dependency specifications (for module authors)
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.07049', }; ... 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.
eval
configure
1.94_56
5.12
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"
test_
Each group name (or a combination thereof) can be used in the public methods as described below.
Modules required for using a config file with dbicdump
Config::Any
Modules required to connect to Sybase ASE
DBD::Sybase
Modules required to connect to DB2
DBD::DB2
Modules required to connect to Firebird
DBD::Firebird
Modules required to connect to Firebird via DBD::InterBase
DBD::InterBase
Modules required to connect to Firebird via DBD::ODBC
DBD::ODBC
Modules required to connect to Informix
DBD::Informix
Modules required to connect to MS Access via DBD::ADO. This particular DBD is available on Windows only
DBD::ADO
Modules required to connect to MS Access via DBD::ODBC
Modules required to connect to MSSQL via DBD::ADO. This particular DBD is available on Windows only
Modules required to connect to MSSQL via DBD::ODBC
Modules required to connect to MSSQL via DBD::Sybase
Modules required to connect to MySQL
DBD::mysql
Modules required to connect to Oracle
DBD::Oracle
Math::Base36 >= 0.07
Math::BigInt >= 1.80
Modules required to connect to PostgreSQL
DBD::Pg
Modules required to connect to SQLAnywhere
DBD::SQLAnywhere
Modules required to connect to SQLAnywhere via DBD::ODBC
Modules required to connect to SQLite
DBD::SQLite
Modules required for using testing using a config file with dbicdump
Config::General
Modules required for testing POD in this distribution
Pod::Simple >= 3.22
Test::Pod >= 1.14
Modules required for the use_moose option
Moose >= 1.12
MooseX::MarkAsMethods >= 0.13
MooseX::NonMoose >= 0.25
namespace::autoclean >= 0.09
Even though this module is not an Exporter, it recognizes several actions supplied to its import method.
actions
import
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.
RELEASE_TESTING
release_testing_mandatory
A convenience wrapper around "die_unless_req_ok_for":
use DBIx::Class::Schema::Loader::Optional::Dependencies -die_without => qw(deploy admin);
A convenience wrapper around "modreq_missing_for":
perl -Ilib -MDBIx::Class::Schema::Loader::Optional::Dependencies=-list_missing,dbicdump_config,rdbms_oracle | cpanm
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.
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.
test_*
req_*
environment variables
module requirements
Same as "req_list_for" but does not take into consideration any environment variable requirements - returns just the list of required modules.
environment variable requirements
Returns true or false depending on whether all modules/envvars required by the group(s) are loadable/set on the system.
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:
deploy
"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"
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".
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:
1
SKIP: { DBIx::Class::Schema::Loader::Optional::Dependencies->skip_without([ deploy YAML>=0.90 ]); ... }
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".
Returns a hashref containing the actual errors that occurred while attempting to load each module in the requirement group(s).
Deprecated method name, equivalent (via proxy) to "modreq_errorlist_for".
Check the list of additional DBIC resources.
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.
To install DBIx::Class::Schema::Loader, copy and paste the appropriate command in to your terminal.
cpanm
cpanm DBIx::Class::Schema::Loader
CPAN shell
perl -MCPAN -e shell install DBIx::Class::Schema::Loader
For more information on module installation, please visit the detailed CPAN module installation guide.