From: Peter Rabbitson Date: Fri, 17 Dec 2010 08:00:40 +0000 (+0100) Subject: Switch the shortener (used only by oracle) reqs to an optional dependency X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=c7d50a7de2182fbfe933fa15b8015cb026f10c54;p=dbsrgits%2FDBIx-Class-Historic.git Switch the shortener (used only by oracle) reqs to an optional dependency --- diff --git a/Makefile.PL b/Makefile.PL index 3a91cc7..67fa6e4 100644 --- a/Makefile.PL +++ b/Makefile.PL @@ -77,12 +77,8 @@ my $runtime_requires = { 'Sub::Name' => '0.04', 'Variable::Magic' => '0.44', - # corelibs needing a specific bugfixed version + # dual-life corelibs needing a specific bugfixed version 'File::Path' => '2.07', - - # Oracle-only optionals - 'Math::BigInt' => '1.89', - 'Math::Base36' => '0.07', }; # this is so we can order requires alphabetically diff --git a/lib/DBIx/Class/Optional/Dependencies.pm b/lib/DBIx/Class/Optional/Dependencies.pm index 30d6244..37759b9 100644 --- a/lib/DBIx/Class/Optional/Dependencies.pm +++ b/lib/DBIx/Class/Optional/Dependencies.pm @@ -38,6 +38,11 @@ my $datetime_basic = { 'DateTime::Format::Strptime' => '1.2', }; +my $id_shortener = { + 'Math::BigInt' => '1.89', + 'Math::Base36' => '0.07', +}; + my $reqs = { dist => { #'Module::Install::Pod::Inherit' => '0.01', @@ -88,10 +93,14 @@ my $reqs = { }, pod => { title => 'Storage::DBI::deploy()', - desc => 'Modules required for L and L', + desc => 'Modules required for L and L', }, }, + id_shortener => { + req => $id_shortener, + }, + test_pod => { req => { 'Test::Pod' => '1.41', @@ -211,6 +220,7 @@ my $reqs = { req => { $ENV{DBICTEST_ORA_DSN} ? ( + %$id_shortener, 'DateTime::Format::Oracle' => '0', 'DBD::Oracle' => '1.24', ) : () diff --git a/lib/DBIx/Class/SQLMaker/Oracle.pm b/lib/DBIx/Class/SQLMaker/Oracle.pm index b2a2c1f..b05f3c2 100644 --- a/lib/DBIx/Class/SQLMaker/Oracle.pm +++ b/lib/DBIx/Class/SQLMaker/Oracle.pm @@ -7,6 +7,13 @@ use strict; use base qw( DBIx::Class::SQLMaker ); use Carp::Clan qw/^DBIx::Class|^SQL::Abstract/; +BEGIN { + use Carp::Clan qw/^DBIx::Class/; + use DBIx::Class::Optional::Dependencies; + croak('The following extra modules are required for Oracle-based Storages ' . DBIx::Class::Optional::Dependencies->req_missing_for ('id_shortener') ) + unless DBIx::Class::Optional::Dependencies->req_ok_for ('id_shortener'); +} + sub new { my $self = shift; my %opts = (ref $_[0] eq 'HASH') ? %{$_[0]} : @_; diff --git a/t/73oracle.t b/t/73oracle.t index 358ac5f..ca373cb 100644 --- a/t/73oracle.t +++ b/t/73oracle.t @@ -40,6 +40,9 @@ use lib qw(t/lib); use DBICTest; use DBIC::SqlMakerTest; +plan skip_all => 'Test needs ' . DBIx::Class::Optional::Dependencies->req_missing_for ('test_rdbms_oracle') + unless DBIx::Class::Optional::Dependencies->req_ok_for ('test_rdbms_oracle'); + $ENV{NLS_SORT} = "BINARY"; $ENV{NLS_COMP} = "BINARY"; $ENV{NLS_LANG} = "AMERICAN"; diff --git a/t/73oracle_hq.t b/t/73oracle_hq.t index d79fae3..11e42ef 100644 --- a/t/73oracle_hq.t +++ b/t/73oracle_hq.t @@ -11,6 +11,9 @@ $ENV{NLS_SORT} = "BINARY"; $ENV{NLS_COMP} = "BINARY"; $ENV{NLS_LANG} = "AMERICAN"; +plan skip_all => 'Test needs ' . DBIx::Class::Optional::Dependencies->req_missing_for ('test_rdbms_oracle') + unless DBIx::Class::Optional::Dependencies->req_ok_for ('test_rdbms_oracle'); + my ($dsn, $user, $pass) = @ENV{map { "DBICTEST_ORA_${_}" } qw/DSN USER PASS/}; plan skip_all => 'Set $ENV{DBICTEST_ORA_DSN}, _USER and _PASS to run this test.' diff --git a/t/sqlmaker/oracle.t b/t/sqlmaker/oracle.t index cb071eb..14e74e2 100644 --- a/t/sqlmaker/oracle.t +++ b/t/sqlmaker/oracle.t @@ -1,6 +1,13 @@ use strict; use warnings; use Test::More; + +BEGIN { + require DBIx::Class::Optional::Dependencies; + plan skip_all => 'Test needs ' . DBIx::Class::Optional::Dependencies->req_missing_for ('id_shortener') + unless DBIx::Class::Optional::Dependencies->req_ok_for ('id_shortener'); +} + use Test::Exception; use Data::Dumper::Concise; use lib qw(t/lib); diff --git a/t/sqlmaker/oraclejoin.t b/t/sqlmaker/oraclejoin.t index 53ba94c..24901a6 100644 --- a/t/sqlmaker/oraclejoin.t +++ b/t/sqlmaker/oraclejoin.t @@ -3,14 +3,18 @@ use warnings; use Test::More; +BEGIN { + require DBIx::Class::Optional::Dependencies; + plan skip_all => 'Test needs ' . DBIx::Class::Optional::Dependencies->req_missing_for ('id_shortener') + unless DBIx::Class::Optional::Dependencies->req_ok_for ('id_shortener'); +} + use lib qw(t/lib); use DBIx::Class::SQLMaker::OracleJoins; use DBICTest; use DBIC::SqlMakerTest; -my $sa = new DBIx::Class::SQLMaker::OracleJoins; - -# search with undefined or empty $cond +my $sa = DBIx::Class::SQLMaker::OracleJoins->new; # my ($self, $table, $fields, $where, $order, @rest) = @_; my ($sql, @bind) = $sa->select(