Merge branch 'topic/fix_dzil'
Karen Etheridge [Tue, 10 Sep 2013 00:28:02 +0000 (17:28 -0700)]
This fixes RT#88542.

Changes
dist.ini
lib/Devel/REPL/Plugin/CompletionDriver/Globals.pm
lib/Devel/REPL/Plugin/CompletionDriver/INC.pm
lib/Devel/REPL/Plugin/CompletionDriver/Keywords.pm
lib/Devel/REPL/Plugin/CompletionDriver/LexEnv.pm
lib/Devel/REPL/Plugin/CompletionDriver/Methods.pm
lib/Devel/REPL/Plugin/CompletionDriver/Turtles.pm
t/load_core.t
t/load_plugins.t

diff --git a/Changes b/Changes
index aa334ac..0ff9244 100644 (file)
--- a/Changes
+++ b/Changes
@@ -1,6 +1,7 @@
 Revision history for {{ $dist->name }}
 
 {{ $NEXT }}
+  - workaround added for plugins consuming plugins that use optional features
 
 1.003021  2013-09-09 02:10:45Z (Karen Etheridge)
   - removed use of deprecated functions from Class::MOP
index 04c3d3c..102b916 100644 (file)
--- a/dist.ini
+++ b/dist.ini
@@ -14,6 +14,8 @@ Test::MinimumVersion.max_target_perl = 5.008001
 -remove = PodCoverageTests  ; XXX TODO
 -remove = Test::PodSpelling ; XXX TODO
 -remove = Test::UnusedVars  ; XXX TODO
+Test::Compile.skip[0] = Devel::REPL::Plugin::CompletionDriver::(INC|Keywords|LexEnv)
+Test::Compile.skip[1] = Devel::REPL::Plugin::(Completion|LexEnv|DDC|DDS|Interrupt|MultiLine::PPI|Nopaste|PPI|Refresh)
 
 [ExecDir]
 dir = script
@@ -39,6 +41,7 @@ Module::Runtime = 0
 [Prereqs / TestRequires]
 Test::More = 0.88
 Test::Warnings = 0
+if = 0
 
 [Prereqs / RuntimeRecommends]
 PPI::XS = 0.902
@@ -51,7 +54,6 @@ PPI::XS = 0.902
 -default = 1
 PPI = 0
 
-
 [OptionalFeature / DDS]
 -description = DDS plugin - better format results with Data::Dump::Streamer
 -always_recommend = 1
index c2e1c74..76a6b0b 100644 (file)
@@ -2,6 +2,7 @@ use strict;
 use warnings;
 package Devel::REPL::Plugin::CompletionDriver::Globals;
 use Devel::REPL::Plugin;
+use Devel::REPL::Plugin::Completion;    # die early if cannot load
 use namespace::autoclean;
 
 sub BEFORE_PLUGIN {
index cdcf74f..a09f8d9 100644 (file)
@@ -2,6 +2,7 @@ use strict;
 use warnings;
 package Devel::REPL::Plugin::CompletionDriver::INC;
 use Devel::REPL::Plugin;
+use Devel::REPL::Plugin::Completion;    # die early if cannot load
 use File::Next;
 use File::Spec;
 use namespace::autoclean;
index 6e127b1..1fc094a 100644 (file)
@@ -2,6 +2,7 @@ use strict;
 use warnings;
 package Devel::REPL::Plugin::CompletionDriver::Keywords;
 use Devel::REPL::Plugin;
+use Devel::REPL::Plugin::Completion;    # die early if cannot load
 use B::Keywords qw/@Functions @Barewords/;
 use namespace::autoclean;
 
index cef75c8..63a05fd 100644 (file)
@@ -2,6 +2,7 @@ use strict;
 use warnings;
 package Devel::REPL::Plugin::CompletionDriver::LexEnv;
 use Devel::REPL::Plugin;
+use Devel::REPL::Plugin::Completion;    # die early if cannot load
 use namespace::autoclean;
 
 sub BEFORE_PLUGIN {
index fa854bd..3f7d2d6 100644 (file)
@@ -2,6 +2,7 @@ use strict;
 use warnings;
 package Devel::REPL::Plugin::CompletionDriver::Methods;
 use Devel::REPL::Plugin;
+use Devel::REPL::Plugin::Completion;    # die early if cannot load
 use namespace::autoclean;
 
 sub BEFORE_PLUGIN {
index 3f5feb1..b888503 100644 (file)
@@ -2,6 +2,7 @@ use strict;
 use warnings;
 package Devel::REPL::Plugin::CompletionDriver::Turtles;
 use Devel::REPL::Plugin;
+use Devel::REPL::Plugin::Completion;    # die early if cannot load
 use namespace::autoclean;
 
 sub BEFORE_PLUGIN {
index 25f635c..612b553 100755 (executable)
@@ -2,86 +2,68 @@ use strict;
 use warnings;
 
 use Test::More;
-use Test::Warnings;
+use if $ENV{AUTHOR_TESTING}, 'Test::Warnings';
 
 use_ok('Devel::REPL');
 use_ok('Devel::REPL::Script');
 use_ok('Devel::REPL::Plugin::Colors');
 use_ok('Devel::REPL::Plugin::Commands');
 
-eval 'use PPI';
-unless ($@) {
-   use_ok('Devel::REPL::Plugin::Completion');
-}
+SKIP: {
+    eval 'use PPI; 1' or skip 'PPI not installed: skipping completion plugins', 6;
 
-eval 'use File::Next';
-unless ($@) {
-   use_ok('Devel::REPL::Plugin::CompletionDriver::INC');
-}
+    use_ok('Devel::REPL::Plugin::Completion');
+    use_ok('Devel::REPL::Plugin::CompletionDriver::Globals');
+    use_ok('Devel::REPL::Plugin::CompletionDriver::Methods');
 
-eval 'use B::Keywords';
-unless ($@) {
-   use_ok('Devel::REPL::Plugin::CompletionDriver::Keywords');
-}
+    test_plugin('File::Next', 'CompletionDriver::INC');
+    test_plugin('B::Keywords', 'CompletionDriver::Keywords');
+    test_plugin('Lexical::Persistence', 'CompletionDriver::LexEnv');
+};
 
-eval 'use Lexical::Persistence';
-unless ($@) {
-   use_ok('Devel::REPL::Plugin::CompletionDriver::LexEnv');
-   use_ok('Devel::REPL::Plugin::LexEnv');
-}
+test_plugin('Lexical::Persistence', 'LexEnv');
 
-use_ok('Devel::REPL::Plugin::CompletionDriver::Globals');
-use_ok('Devel::REPL::Plugin::CompletionDriver::Methods');
+test_plugin('Data::Dumper::Concise', 'DDC');
 
-eval 'use Data::Dump::Concise';
-unless ($@) {
-   use_ok('Devel::REPL::Plugin::DDC');
-}
-
-eval 'use Data::Dump::Streamer';
-unless ($@) {
-   use_ok('Devel::REPL::Plugin::DDS');
-}
+test_plugin('Data::Dump::Streamer', 'DDS');
 
 use_ok('Devel::REPL::Plugin::DumpHistory');
 use_ok('Devel::REPL::Plugin::FancyPrompt');
 use_ok('Devel::REPL::Plugin::FindVariable');
 use_ok('Devel::REPL::Plugin::History');
 
-eval 'use Sys::SigAction';
-unless ($@) {
-   use_ok('Devel::REPL::Plugin::Interrupt');
-}
+test_plugin('Sys::SigAction', 'Interrupt');
 
 # use_ok('Devel::REPL::Plugin::Interrupt') unless $^O eq 'MSWin32';
 
-eval 'use PPI';
-unless ($@) {
-   use_ok('Devel::REPL::Plugin::MultiLine::PPI');
-}
+test_plugin('PPI', 'MultiLine::PPI');
 
-eval 'use App::Nopaste';
-unless ($@) {
-   use_ok('Devel::REPL::Plugin::Nopaste');
-}
+test_plugin('App::Nopaste', 'Nopaste');
 
 use_ok('Devel::REPL::Plugin::OutputCache');
 use_ok('Devel::REPL::Plugin::Packages');
 use_ok('Devel::REPL::Plugin::Peek');
-eval 'use PPI';
-unless ($@) {
-   use_ok('Devel::REPL::Plugin::PPI');
-}
+
+test_plugin('PPI' ,'PPI');
 
 use_ok('Devel::REPL::Plugin::ReadLineHistory');
 
-eval 'use Module::Refresh';
-unless ($@) {
-   use_ok('Devel::REPL::Plugin::Refresh');
-}
+test_plugin('Module::Refresh', 'Refresh');
 
 use_ok('Devel::REPL::Plugin::ShowClass');
 use_ok('Devel::REPL::Plugin::Timing');
 use_ok('Devel::REPL::Plugin::Turtles');
 
+sub test_plugin
+{
+    my ($prereq, $plugin) = @_;
+
+    SKIP: {
+        eval "use $prereq; 1"
+            or skip "$prereq not installed: skipping $plugin", 1;
+
+        use_ok("Devel::REPL::Plugin::$plugin");
+    }
+}
+
 done_testing;
index 0115c8b..e7d1655 100755 (executable)
@@ -3,7 +3,7 @@ use strict;
 use warnings;
 
 use Test::More;
-use Test::Warnings;
+use if $ENV{AUTHOR_TESTING}, 'Test::Warnings';
 
 use_ok('Devel::REPL');
 
@@ -54,16 +54,13 @@ for my $plugin_name (@plugins) {
 sub test_load_plugin {
     my ($plugin_name) = @_;
     my $test_name = "plugin $plugin_name loaded";
-    eval "use Devel::REPL::Plugin::$plugin_name";
-    unless($@) {
-        eval { $repl->load_plugin($plugin_name) };
-        ok(!$@, $test_name);
-    } else {
-        SKIP: {
-                skip "could not eval plugin $plugin_name", 1;
-        }
+
+    SKIP: {
+        eval "use Devel::REPL::Plugin::$plugin_name; 1"
+            or skip "could not eval plugin $plugin_name", 1;
+
+        ok(eval { $repl->load_plugin($plugin_name); 1 }, $test_name);
     }
 }
 
 done_testing;
-