From: Peter Rabbitson Date: Sat, 9 May 2015 12:20:28 +0000 (+0200) Subject: Remove Config::Any from the core dep set X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=0dd1b7362ff4b104d68946ae6ca8e7e483621381;p=dbsrgits%2FDBIx-Class-Historic.git Remove Config::Any from the core dep set Originally introduced by b6cd6478, the dep is used *very* rarely. Relegate it to optdep state instead, thus removing a Module::Pluggable entry from the depchain (evicted from core in 5.20) --- diff --git a/Changes b/Changes index 597c6a4..5dfe3db 100644 --- a/Changes +++ b/Changes @@ -57,6 +57,8 @@ Revision history for DBIx::Class - Work around rare test deadlock under heavy parallelism (RT#108390) - Stop using bare $] throughout - protects the codebase from issues similar (but likely not limited to) P5#72210 + - Config::Any is no longer a core dep, but instead is migrated to a new + optdep group 'config_file_reader' 0.082820 2015-03-20 20:35 (UTC) * Fixes diff --git a/Makefile.PL b/Makefile.PL index a7f87ed..f4ac1b8 100644 --- a/Makefile.PL +++ b/Makefile.PL @@ -56,7 +56,6 @@ my $runtime_requires = { 'Class::Accessor::Grouped' => '0.10012', 'Class::C3::Componentised' => '1.0009', 'Class::Inspector' => '1.24', - 'Config::Any' => '0.20', 'Context::Preserve' => '0.01', 'Data::Dumper::Concise' => '2.020', 'Data::Page' => '2.00', diff --git a/lib/DBIx/Class/Admin.pm b/lib/DBIx/Class/Admin.pm index 65c703d..60d8c9e 100644 --- a/lib/DBIx/Class/Admin.pm +++ b/lib/DBIx/Class/Admin.pm @@ -18,7 +18,6 @@ use DBIx::Class::Admin::Types qw/DBICConnectInfo DBICHashRef/; use MooseX::Types::JSON qw(JSON); use MooseX::Types::Path::Class qw(Dir File); use MooseX::Types::LoadableClass qw(LoadableClass); -use Try::Tiny; use namespace::clean; =head1 NAME @@ -210,9 +209,6 @@ has config => ( sub _build_config { my ($self) = @_; - try { require Config::Any } - catch { die ("Config::Any is required to parse the config file.\n") }; - my $cfg = Config::Any->load_files ( {files => [$self->config_file], use_ext =>1, flatten_to_hash=>1}); # just grab the config from the config file diff --git a/lib/DBIx/Class/Optional/Dependencies.pm b/lib/DBIx/Class/Optional/Dependencies.pm index cf0cb76..946cb7a 100644 --- a/lib/DBIx/Class/Optional/Dependencies.pm +++ b/lib/DBIx/Class/Optional/Dependencies.pm @@ -98,8 +98,18 @@ my $dbic_reqs = { }, }, + config_file_reader => { + pod => { + title => 'Generic config reader', + desc => 'Modules required for generic config file parsing, currently Config::Any (rarely used at runtime)', + }, + req => { + 'Config::Any' => '0.20', + }, + }, + admin => { - include => '_json_any', + include => [qw( _json_any config_file_reader )], req => { %$moose_basic, 'MooseX::Types::Path::Class' => '0.05', diff --git a/lib/DBIx/Class/Storage.pm b/lib/DBIx/Class/Storage.pm index 032b247..fc87ceb 100644 --- a/lib/DBIx/Class/Storage.pm +++ b/lib/DBIx/Class/Storage.pm @@ -572,7 +572,10 @@ sub debugobj { my @pp_args; if ($profile =~ /^\.?\//) { - require Config::Any; + + if ( my $missing = DBIx::Class::Optional::Dependencies->req_missing_for ('config_file_reader') ) { + $self->throw_exception("Unable to parse TRACE_PROFILE config file '$profile' without $missing"); + } my $cfg = try { Config::Any->load_files({ files => [$profile], use_ext => 1 }); diff --git a/t/storage/dbic_pretty.t b/t/storage/dbic_pretty.t index b29d1d6..1a1c32e 100644 --- a/t/storage/dbic_pretty.t +++ b/t/storage/dbic_pretty.t @@ -24,7 +24,9 @@ BEGIN { delete @ENV{qw(DBIC_TRACE_PROFILE)} } is($schema->storage->debugobj->_sqlat->indent_string, ' ', 'indent string set correctly from console profile'); } -{ +SKIP:{ + DBIx::Class::Optional::Dependencies->skip_without('config_file_reader' ); + local $ENV{DBIC_TRACE_PROFILE} = './t/lib/awesome.json'; my $schema = DBICTest->init_schema;