[libtest-bdd-cucumber-perl] 01/09: Replacing string `eval` with block `eval`

Intrigeri intrigeri at moszumanska.debian.org
Thu Jun 19 10:18:50 UTC 2014


This is an automated email from the git hooks/post-receive script.

intrigeri pushed a commit to annotated tag 0.24
in repository libtest-bdd-cucumber-perl.

commit 44dc4ddf87260dd051128ba1d920a324d479b369
Author: Paul Cochrane <paul at liekut.de>
Date:   Thu Jun 5 11:36:19 2014 +0200

    Replacing string `eval` with block `eval`
    
    This change is modelled on comments and recommendations from @shadowcat-mst
    and this time should actually have executable code!
---
 dist.ini                                   | 1 +
 lib/App/pherkin.pm                         | 3 ++-
 lib/Test/BDD/Cucumber/Harness/TermColor.pm | 2 +-
 3 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/dist.ini b/dist.ini
index f4ff872..2c2fb47 100644
--- a/dist.ini
+++ b/dist.ini
@@ -19,6 +19,7 @@ File::Slurp = 0
 FindBin::libs = 0
 Getopt::Long = 0
 JSON::MaybeXS = 0
+Module::Runtime = 0
 Moose = 0
 Ouch = 0
 Path::Class = 0
diff --git a/lib/App/pherkin.pm b/lib/App/pherkin.pm
index f0b0b4d..78b989b 100644
--- a/lib/App/pherkin.pm
+++ b/lib/App/pherkin.pm
@@ -35,6 +35,7 @@ using the default output harness.
 =cut
 
 use Test::BDD::Cucumber::Loader;
+use Module::Runtime qw(use_module);
 
 =head1 METHODS
 
@@ -61,7 +62,7 @@ sub run {
     );
     die "No feature files found" unless @features;
 
-    eval "require $options->{'harness'}" || die $@;
+    eval { use_module($options->{'harness'}) } || die $@;
     my $harness  = $options->{'harness'}->new();
     $harness->startup();
 
diff --git a/lib/Test/BDD/Cucumber/Harness/TermColor.pm b/lib/Test/BDD/Cucumber/Harness/TermColor.pm
index 7a08e14..b4b055e 100644
--- a/lib/Test/BDD/Cucumber/Harness/TermColor.pm
+++ b/lib/Test/BDD/Cucumber/Harness/TermColor.pm
@@ -29,7 +29,7 @@ BEGIN {
         (! $ENV{'DISABLE_WIN32_FALLBACK'} )
     ) {
         # Try and load
-        eval "require Win32::Console::ANSI";
+        eval { require Win32::Console::ANSI };
         if ( $@ ) {
             print "# Install Win32::Console::ANSI to display colors properly\n";
         }

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-perl/packages/libtest-bdd-cucumber-perl.git



More information about the Pkg-perl-cvs-commits mailing list